1 | <?php |
||
27 | class Nav |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * Current active menu. |
||
32 | * |
||
33 | * @see CroogoNav::activeMenu() |
||
34 | */ |
||
35 | protected static $_activeMenu = 'sidebar'; |
||
36 | |||
37 | /** |
||
38 | * Menu items. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | protected static $_items = ['sidebar' => []]; |
||
43 | |||
44 | /** |
||
45 | * Default params. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected static $_defaults = [ |
||
50 | 'icon' => '', |
||
51 | 'title' => false, |
||
52 | 'url' => '#', |
||
53 | 'weight' => 9999, |
||
54 | 'before' => false, |
||
55 | 'after' => false, |
||
56 | 'access' => [], |
||
57 | 'children' => [], |
||
58 | 'htmlAttributes' => [], |
||
59 | ]; |
||
60 | |||
61 | /** |
||
62 | * Getter/setter for activeMenu |
||
63 | * |
||
64 | * @param null $menu |
||
65 | * @return null|string |
||
66 | */ |
||
67 | public static function activeMenu($menu = null) |
||
82 | |||
83 | /** |
||
84 | * Add a menu item. |
||
85 | * |
||
86 | * @param $menu |
||
87 | * @param $path |
||
88 | * @param array $options |
||
89 | */ |
||
90 | public static function add($menu, $path, $options = []) |
||
121 | |||
122 | /** |
||
123 | * Clear all menus. |
||
124 | * |
||
125 | * @param string $menu |
||
126 | * @return void |
||
127 | */ |
||
128 | public static function clear($menu = 'sidebar') |
||
136 | |||
137 | /** |
||
138 | * Gets default settings for menu items. |
||
139 | * |
||
140 | * @return array |
||
141 | */ |
||
142 | public static function getDefaults() |
||
146 | |||
147 | /** |
||
148 | * Sets or returns menu data in array. |
||
149 | * |
||
150 | * @param string $menu |
||
151 | * @param null $items |
||
152 | * @return array |
||
153 | */ |
||
154 | public static function items($menu = 'sidebar', $items = null) |
||
171 | |||
172 | /** |
||
173 | * Get menus. |
||
174 | * |
||
175 | * @return array |
||
176 | */ |
||
177 | public static function menus() |
||
181 | |||
182 | /** |
||
183 | * Remove a menu item. |
||
184 | * |
||
185 | * @param string $path dot separated path in the array. |
||
186 | * @return void |
||
187 | */ |
||
188 | public static function remove($path) |
||
192 | |||
193 | /** |
||
194 | * Clear menu items. |
||
195 | * |
||
196 | * @param $menu |
||
197 | * @throws \UnexpectedValueException |
||
198 | */ |
||
199 | protected static function _clear($menu) |
||
207 | |||
208 | /** |
||
209 | * Merge $firstArray with $secondArray. |
||
210 | * |
||
211 | * Similar to Hash::merge, except duplicates are removed |
||
212 | * @param array $firstArray |
||
213 | * @param array $secondArray |
||
214 | * @return array |
||
215 | */ |
||
216 | protected static function _merge($firstArray, $secondArray) |
||
226 | |||
227 | /** |
||
228 | * Replace a menu element. |
||
229 | * |
||
230 | * @param array $target pointer to start of array |
||
231 | * @param string $path path to search for in dot separated format |
||
232 | * @param array $options data to replace with |
||
233 | * @return void |
||
234 | */ |
||
235 | protected static function _replace(&$target, $path, $options) |
||
247 | |||
248 | /** |
||
249 | * Setup options. |
||
250 | * |
||
251 | * @param array $options |
||
252 | * @return void |
||
253 | */ |
||
254 | protected static function _setupOptions(&$options) |
||
261 | } |
||
262 |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.