1 | <?php |
||
31 | 1 | final class DecoratorsManager implements \ArrayAccess, \IteratorAggregate |
|
32 | { |
||
33 | /** |
||
34 | * Implement nette smart magic |
||
35 | */ |
||
36 | 1 | use Nette\SmartObject; |
|
37 | |||
38 | /** |
||
39 | * @var Decorators\IFactory[] |
||
40 | */ |
||
41 | protected $decorators = []; |
||
42 | |||
43 | /** |
||
44 | * Check if a decorator is registered |
||
45 | * |
||
46 | * @param string $name |
||
47 | * |
||
48 | * @return boolean |
||
49 | */ |
||
50 | public function has(string $name) : bool |
||
54 | |||
55 | /** |
||
56 | * Returns a registered decorator class |
||
57 | * |
||
58 | * @param string $name |
||
59 | * |
||
60 | * @return Decorators\IFactory|NULL |
||
61 | */ |
||
62 | public function get(string $name) : ?Decorators\IFactory |
||
66 | |||
67 | /** |
||
68 | * Register a decorator component factory |
||
69 | * |
||
70 | * @param Decorators\IFactory $decorator |
||
71 | * @param string $name |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | public function register(Decorators\IFactory $decorator, string $name) : void |
||
83 | |||
84 | /** |
||
85 | * Un-registers a decorator |
||
86 | * |
||
87 | * @param string $name |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | public function unregister(string $name) : void |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function getIterator() |
||
105 | |||
106 | /** |
||
107 | * Implements the \ArrayAccess |
||
108 | * |
||
109 | * @param string $offset |
||
110 | * |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function offsetExists($offset) |
||
117 | |||
118 | /** |
||
119 | * Implements the \ArrayAccess |
||
120 | * |
||
121 | * @param string $offset |
||
122 | * |
||
123 | * @return Decorators\IFactory |
||
124 | */ |
||
125 | public function offsetGet($offset) |
||
129 | |||
130 | /** |
||
131 | * Implements the \ArrayAccess |
||
132 | * |
||
133 | * @param string $offset |
||
134 | * @param Decorators\IFactory|NULL $value |
||
135 | */ |
||
136 | public function offsetSet($offset, $value) |
||
140 | |||
141 | /** |
||
142 | * Implements the \ArrayAccess |
||
143 | * |
||
144 | * @param string $offset |
||
145 | */ |
||
146 | public function offsetUnset($offset) |
||
150 | } |
||
151 |