TWidgets::createComponentWidgets()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * TWidgets.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
8
 * @package        iPublikuj:Widgets!
9
 * @subpackage     common
10
 * @since          1.0.0
11
 *
12
 * @date           18.06.15
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\Widgets;
18
19
use Nette\Application;
20
21
use IPub\Widgets\Components;
22
23
trait TWidgets
24
{
25
	/**
26
	 * @var Components\IControl
27
	 */
28
	protected $widgetsFactory;
29
30
	/**
31
	 * @param Components\IControl $widgetsFactory
32
	 */
33
	public function injectWidgets(Components\IControl $widgetsFactory) : void
34
	{
35
		$this->widgetsFactory = $widgetsFactory;
36
	}
37
38
	/**
39
	 * Widgets component
40
	 *
41
	 * @return Application\UI\Multiplier
42
	 */
43
	public function createComponentWidgets() : Application\UI\Multiplier
44
	{
45
		return new Application\UI\Multiplier(function ($position) : Components\Control {
46
			return $this->widgetsFactory->create($position);
47
		});
48
	}
49
}
50