1 | <?php |
||
32 | 1 | final class WidgetsManager extends Nette\Object implements \ArrayAccess, \IteratorAggregate |
|
33 | { |
||
34 | /** |
||
35 | * @var Widgets\IFactory[][] |
||
36 | */ |
||
37 | private $widgets = [ |
||
38 | 'default' => [] |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * Checks whether a widget is registered |
||
43 | * |
||
44 | * @param string $type |
||
45 | * @param string $group |
||
46 | * |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function has(string $type, string $group = 'default'): bool |
||
53 | |||
54 | /** |
||
55 | * Gets a widget |
||
56 | * |
||
57 | * @param string $type |
||
58 | * @param string $group |
||
59 | * |
||
60 | * @return Widgets\IFactory|NULL |
||
61 | */ |
||
62 | public function get(string $type, string $group = 'default') |
||
71 | |||
72 | /** |
||
73 | * Helper method for widgets factories registering |
||
74 | * |
||
75 | * @param Widgets\IFactory $factory |
||
76 | * @param string $type |
||
77 | * @param string $group |
||
78 | */ |
||
79 | public function register(Widgets\IFactory $factory, string $type, string $group = 'default') |
||
86 | |||
87 | /** |
||
88 | * Implements the \IteratorAggregate |
||
89 | * |
||
90 | * @return \Iterator |
||
91 | */ |
||
92 | public function getIterator() |
||
96 | |||
97 | /** |
||
98 | * Implements the \ArrayAccess |
||
99 | * |
||
100 | * @param string $offset |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | public function offsetExists($offset) |
||
108 | |||
109 | /** |
||
110 | * Implements the \ArrayAccess |
||
111 | * |
||
112 | * @param string $offset |
||
113 | * |
||
114 | * @return Widgets\IFactory[] |
||
115 | */ |
||
116 | public function offsetGet($offset) |
||
120 | |||
121 | /** |
||
122 | * Implements the \ArrayAccess |
||
123 | * |
||
124 | * @param string $offset |
||
125 | * @param Widgets\IFactory[]|NULL $value |
||
126 | */ |
||
127 | public function offsetSet($offset, $value) |
||
131 | |||
132 | /** |
||
133 | * Implements the \ArrayAccess |
||
134 | * |
||
135 | * @param string $offset |
||
136 | */ |
||
137 | public function offsetUnset($offset) |
||
141 | } |
||
142 |