TWidgets   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A injectWidgets() 0 4 1
A createComponentWidgets() 0 6 1
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