1 | <?php |
||
32 | 1 | final class FiltersManager implements \ArrayAccess, \IteratorAggregate |
|
33 | { |
||
34 | /** |
||
35 | * Implement nette smart magic |
||
36 | */ |
||
37 | 1 | use Nette\SmartObject; |
|
38 | |||
39 | /** |
||
40 | * @var \SplPriorityQueue |
||
41 | */ |
||
42 | private $filters = []; |
||
43 | |||
44 | /** |
||
45 | * @var Filters\IFactory[] |
||
46 | */ |
||
47 | private $factories = []; |
||
48 | |||
49 | public function __construct() |
||
53 | |||
54 | /** |
||
55 | * Check if a filter is registered |
||
56 | * |
||
57 | * @param string $name |
||
58 | * |
||
59 | * @return boolean |
||
60 | */ |
||
61 | public function has(string $name) : bool |
||
65 | |||
66 | /** |
||
67 | * Returns a registered filter class |
||
68 | * |
||
69 | * @param string $name |
||
70 | * |
||
71 | * @return Filters\IFactory|NULL |
||
72 | */ |
||
73 | public function get(string $name) : ?Filters\IFactory |
||
77 | |||
78 | /** |
||
79 | * Register a filter class name |
||
80 | * |
||
81 | * @param Filters\IFactory $filter |
||
82 | * @param string $name |
||
83 | * @param int $priority |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | public function register(Filters\IFactory $filter, string $name, int $priority = 0) : void |
||
94 | |||
95 | /** |
||
96 | * Unregisters a filter |
||
97 | * |
||
98 | * @param string $name |
||
99 | * |
||
100 | * @return void |
||
101 | */ |
||
102 | public function unregister(string $name) : void |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public function getIterator() |
||
130 | |||
131 | /** |
||
132 | * Implements the \ArrayAccess |
||
133 | * |
||
134 | * @param string $offset |
||
135 | * |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function offsetExists($offset) |
||
142 | |||
143 | /** |
||
144 | * Implements the \ArrayAccess |
||
145 | * |
||
146 | * @param string $offset |
||
147 | * |
||
148 | * @return mixed |
||
149 | */ |
||
150 | public function offsetGet($offset) |
||
154 | |||
155 | /** |
||
156 | * Implements the \ArrayAccess |
||
157 | * |
||
158 | * @param string $offset |
||
159 | * @param string[]|NULL $value |
||
160 | * |
||
161 | * @throws Exceptions\InvalidStateException |
||
162 | */ |
||
163 | public function offsetSet($offset, $value) |
||
167 | |||
168 | /** |
||
169 | * Implements the \ArrayAccess |
||
170 | * |
||
171 | * @param string $offset |
||
172 | * |
||
173 | * @throws Exceptions\InvalidStateException |
||
174 | */ |
||
175 | public function offsetUnset($offset) |
||
179 | } |
||
180 |