1 | <?php |
||
7 | class ClassyMenu { |
||
|
|||
8 | |||
9 | /** |
||
10 | * Menu ID |
||
11 | * @var int |
||
12 | */ |
||
13 | public $ID; |
||
14 | |||
15 | /** |
||
16 | * Items |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $items; |
||
20 | |||
21 | /** |
||
22 | * Main constructor. Tries to find menu id based on provided arg (or not) and inits menu |
||
23 | * |
||
24 | * @param string $arg it can be menu id, slug or full name |
||
25 | */ |
||
26 | public function __construct($arg = null) { |
||
53 | |||
54 | /** |
||
55 | * Inits menu |
||
56 | * |
||
57 | * @return void |
||
58 | */ |
||
59 | protected function init() { |
||
87 | |||
88 | /** |
||
89 | * Retuns first menu id or false if there are no menus |
||
90 | * |
||
91 | * @return int |
||
92 | */ |
||
93 | protected function get_first_menu_id() { |
||
110 | |||
111 | /** |
||
112 | * Checks if the provided menu id exists |
||
113 | * |
||
114 | * @param int $menu_id |
||
115 | * @return int/boolean |
||
116 | */ |
||
117 | protected function check_menu_id($menu_id) { |
||
138 | |||
139 | /** |
||
140 | * Returns menu id by menu name/slug |
||
141 | * |
||
142 | * @param string $slug |
||
143 | * @return int |
||
144 | */ |
||
145 | protected function get_menu_id_by_name($slug = null) { |
||
162 | |||
163 | /** |
||
164 | * Returns menu items |
||
165 | * |
||
166 | * @return array |
||
167 | */ |
||
168 | public function get_items() { |
||
173 | |||
174 | |||
175 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.