1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\Application\UI;
9:
10: use Nette;
11:
12:
13: /**
14: * Component multiplier.
15: */
16: class Multiplier extends PresenterComponent
17: {
18: /** @var callable */
19: private $factory;
20:
21:
22: /**
23: * @param callable
24: */
25: public function __construct($factory)
26: {
27: parent::__construct();
28: $this->factory = Nette\Utils\Callback::check($factory);
29: }
30:
31:
32: protected function createComponent($name)
33: {
34: return call_user_func($this->factory, $name, $this);
35: }
36:
37: }
38: