1 | <?php namespace Arcanesoft\Sidebar; |
||
13 | class SidebarItem implements Arrayable |
||
14 | { |
||
15 | /* ----------------------------------------------------------------- |
||
16 | | Properties |
||
17 | | ----------------------------------------------------------------- |
||
18 | */ |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $name; |
||
22 | |||
23 | /** @var string */ |
||
24 | public $title; |
||
25 | |||
26 | /** @var string */ |
||
27 | public $url; |
||
28 | |||
29 | /** @var string */ |
||
30 | public $icon; |
||
31 | |||
32 | /** @var \Arcanesoft\Sidebar\SidebarCollection */ |
||
33 | public $children; |
||
34 | |||
35 | /** @var array */ |
||
36 | protected $roles; |
||
37 | |||
38 | /** @var array */ |
||
39 | protected $permissions; |
||
40 | |||
41 | /** @var boolean */ |
||
42 | private $selected; |
||
43 | |||
44 | /* ----------------------------------------------------------------- |
||
45 | | Constructor |
||
46 | | ----------------------------------------------------------------- |
||
47 | */ |
||
48 | |||
49 | /** |
||
50 | * SidebarItem constructor. |
||
51 | * |
||
52 | * @param array $attributes |
||
53 | */ |
||
54 | 16 | public function __construct(array $attributes) |
|
68 | |||
69 | /* ----------------------------------------------------------------- |
||
70 | | Setters & Getters |
||
71 | | ----------------------------------------------------------------- |
||
72 | */ |
||
73 | |||
74 | /** |
||
75 | * Set the title. |
||
76 | * |
||
77 | * @param string $title |
||
78 | * |
||
79 | * @return $this |
||
80 | */ |
||
81 | 16 | public function setTitle(string $title) |
|
89 | |||
90 | /** |
||
91 | * Set the url. |
||
92 | * |
||
93 | * @param string $url |
||
94 | * |
||
95 | * @return $this |
||
96 | */ |
||
97 | 16 | public function setUrl(string $url) |
|
103 | |||
104 | /** |
||
105 | * Set the selected item. |
||
106 | * |
||
107 | * @param string $name |
||
108 | * |
||
109 | * @return $this |
||
110 | */ |
||
111 | 4 | public function setSelected(string $name) |
|
118 | |||
119 | /* ----------------------------------------------------------------- |
||
120 | | Main Methods |
||
121 | | ----------------------------------------------------------------- |
||
122 | */ |
||
123 | |||
124 | /** |
||
125 | * Set the url from the route. |
||
126 | * |
||
127 | * @param string $name |
||
128 | * @param array $params |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function route($name, array $params = []) |
||
138 | |||
139 | /** |
||
140 | * Set the url from the action. |
||
141 | * |
||
142 | * @param string|array $name |
||
143 | * @param array $params |
||
144 | * |
||
145 | * @return $this |
||
146 | */ |
||
147 | public function action($name, array $params = []) |
||
153 | |||
154 | /** |
||
155 | * Set the icon. |
||
156 | * |
||
157 | * @param string $classes |
||
158 | * |
||
159 | * @return \Illuminate\Support\HtmlString |
||
160 | */ |
||
161 | public function icon($classes = '') : HtmlString |
||
169 | |||
170 | /** |
||
171 | * Get the active/inactive class. |
||
172 | * |
||
173 | * @param string $active |
||
174 | * @param string $inactive |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | public function active($active = 'active', $inactive = ''): string |
||
182 | |||
183 | /* ----------------------------------------------------------------- |
||
184 | | Check Methods |
||
185 | | ----------------------------------------------------------------- |
||
186 | */ |
||
187 | |||
188 | /** |
||
189 | * Check if has children. |
||
190 | * |
||
191 | * @return bool |
||
192 | */ |
||
193 | public function hasChildren(): bool |
||
197 | |||
198 | /** |
||
199 | * Check if the item is active. |
||
200 | * |
||
201 | * @return bool |
||
202 | */ |
||
203 | 12 | public function isActive() : bool |
|
207 | |||
208 | /** |
||
209 | * Check if the item is selected. |
||
210 | * |
||
211 | * @return bool |
||
212 | */ |
||
213 | 12 | public function isSelected() : bool |
|
217 | |||
218 | /* ----------------------------------------------------------------- |
||
219 | | Other Methods |
||
220 | | ----------------------------------------------------------------- |
||
221 | */ |
||
222 | |||
223 | /** |
||
224 | * Parse the url attribute. |
||
225 | * |
||
226 | * @param array $attributes |
||
227 | * |
||
228 | * @return void |
||
229 | */ |
||
230 | 16 | protected function parseUrl(array $attributes) : void |
|
241 | |||
242 | /** |
||
243 | * Get the instance as an array. |
||
244 | * |
||
245 | * @return array |
||
246 | */ |
||
247 | 12 | public function toArray() |
|
260 | } |
||
261 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..