@@ -45,7 +45,7 @@ |
||
45 | 45 | * Create new menu. |
46 | 46 | * |
47 | 47 | * @param string $name |
48 | - * @param Callable $resolver |
|
48 | + * @param Closure $resolver |
|
49 | 49 | * |
50 | 50 | * @return \Nwidart\Menus\MenuBuilder |
51 | 51 | */ |
@@ -93,7 +93,7 @@ |
||
93 | 93 | */ |
94 | 94 | public function modify($name, Closure $callback) |
95 | 95 | { |
96 | - $menu = collect($this->menus)->filter(function ($menu) use ($name) { |
|
96 | + $menu = collect($this->menus)->filter(function($menu) use ($name) { |
|
97 | 97 | return $menu->getName() == $name; |
98 | 98 | })->first(); |
99 | 99 |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | /** |
216 | 216 | * Determine if the given name in the presenter style. |
217 | 217 | * |
218 | - * @param $name |
|
218 | + * @param string|null $name |
|
219 | 219 | * |
220 | 220 | * @return bool |
221 | 221 | */ |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @param $name |
241 | 241 | * |
242 | - * @return mixed |
|
242 | + * @return string |
|
243 | 243 | */ |
244 | 244 | public function getStyle($name) |
245 | 245 | { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * Set new presenter class from given alias name. |
253 | 253 | * |
254 | - * @param $name |
|
254 | + * @param string|null $name |
|
255 | 255 | */ |
256 | 256 | public function setPresenterFromStyle($name) |
257 | 257 | { |
@@ -261,7 +261,6 @@ discard block |
||
261 | 261 | /** |
262 | 262 | * Set the resolved item bindings |
263 | 263 | * |
264 | - * @param array $arr |
|
265 | 264 | */ |
266 | 265 | public function setBindings(array $bindings) |
267 | 266 | { |
@@ -332,10 +331,10 @@ discard block |
||
332 | 331 | * Create new menu with dropdown. |
333 | 332 | * |
334 | 333 | * @param $title |
335 | - * @param callable $callback |
|
334 | + * @param \Closure $callback |
|
336 | 335 | * @param array $attributes |
337 | 336 | * |
338 | - * @return $this |
|
337 | + * @return MenuItem |
|
339 | 338 | */ |
340 | 339 | public function dropdown($title, \Closure $callback, $order = null, array $attributes = array()) |
341 | 340 | { |
@@ -367,7 +366,7 @@ discard block |
||
367 | 366 | * @param array $parameters |
368 | 367 | * @param array $attributes |
369 | 368 | * |
370 | - * @return static |
|
369 | + * @return MenuItem |
|
371 | 370 | */ |
372 | 371 | public function route($route, $title, $parameters = array(), $order = null, $attributes = array()) |
373 | 372 | { |
@@ -409,11 +408,11 @@ discard block |
||
409 | 408 | /** |
410 | 409 | * Register new menu item using url. |
411 | 410 | * |
412 | - * @param $url |
|
413 | - * @param $title |
|
411 | + * @param string $url |
|
412 | + * @param string $title |
|
414 | 413 | * @param array $attributes |
415 | 414 | * |
416 | - * @return static |
|
415 | + * @return MenuItem |
|
417 | 416 | */ |
418 | 417 | public function url($url, $title, $order = 0, $attributes = array()) |
419 | 418 | { |
@@ -440,7 +439,7 @@ discard block |
||
440 | 439 | * Add new divider item. |
441 | 440 | * |
442 | 441 | * @param int $order |
443 | - * @return \Nwidart\Menus\MenuItem |
|
442 | + * @return MenuBuilder |
|
444 | 443 | */ |
445 | 444 | public function addDivider($order = null) |
446 | 445 | { |
@@ -452,7 +451,8 @@ discard block |
||
452 | 451 | /** |
453 | 452 | * Add new header item. |
454 | 453 | * |
455 | - * @return \Nwidart\Menus\MenuItem |
|
454 | + * @param string $title |
|
455 | + * @return MenuBuilder |
|
456 | 456 | */ |
457 | 457 | public function addHeader($title, $order = null) |
458 | 458 | { |
@@ -536,6 +536,7 @@ discard block |
||
536 | 536 | /** |
537 | 537 | * Render menu via view presenter. |
538 | 538 | * |
539 | + * @param string $presenter |
|
539 | 540 | * @return \Illuminate\View\View |
540 | 541 | */ |
541 | 542 | public function renderView($presenter = null) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function findBy($key, $value) |
121 | 121 | { |
122 | - return collect($this->items)->filter(function ($item) use ($key, $value) { |
|
122 | + return collect($this->items)->filter(function($item) use ($key, $value) { |
|
123 | 123 | return $item->{$key} == $value; |
124 | 124 | })->first(); |
125 | 125 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | protected function resolveItems(array &$items) |
305 | 305 | { |
306 | - $resolver = function ($property) { |
|
306 | + $resolver = function($property) { |
|
307 | 307 | return $this->resolve($property) ?: $property; |
308 | 308 | }; |
309 | 309 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | public function getOrderedItems() |
608 | 608 | { |
609 | 609 | if (config('menus.ordering') || $this->ordering) { |
610 | - return $this->toCollection()->sortBy(function ($item) { |
|
610 | + return $this->toCollection()->sortBy(function($item) { |
|
611 | 611 | return $item->order; |
612 | 612 | })->all(); |
613 | 613 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * Register new child menu with dropdown. |
139 | 139 | * |
140 | 140 | * @param $title |
141 | - * @param callable $callback |
|
141 | + * @param Closure $callback |
|
142 | 142 | * |
143 | 143 | * @return $this |
144 | 144 | */ |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param array $parameters |
173 | 173 | * @param array $attributes |
174 | 174 | * |
175 | - * @return array |
|
175 | + * @return MenuItem |
|
176 | 176 | */ |
177 | 177 | public function route($route, $title, $parameters = array(), $order = 0, $attributes = array()) |
178 | 178 | { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param $title |
199 | 199 | * @param array $attributes |
200 | 200 | * |
201 | - * @return array |
|
201 | + * @return MenuItem |
|
202 | 202 | */ |
203 | 203 | public function url($url, $title, $order = 0, $attributes = array()) |
204 | 204 | { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | /** |
384 | 384 | * Check is the current item divider. |
385 | 385 | * |
386 | - * @param $name |
|
386 | + * @param string $name |
|
387 | 387 | * |
388 | 388 | * @return bool |
389 | 389 | */ |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | /** |
416 | 416 | * Check the active state for current menu. |
417 | 417 | * |
418 | - * @return mixed |
|
418 | + * @return boolean |
|
419 | 419 | */ |
420 | 420 | public function hasActiveOnChild() |
421 | 421 | { |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * Set hide condition for current menu item. |
568 | 568 | * |
569 | 569 | * @param Closure |
570 | - * @return boolean |
|
570 | + * @return MenuItem |
|
571 | 571 | */ |
572 | 572 | public function hideWhen(Closure $callback) |
573 | 573 | { |
@@ -296,7 +296,7 @@ |
||
296 | 296 | public function getChilds() |
297 | 297 | { |
298 | 298 | if (config('menus.ordering')) { |
299 | - return collect($this->childs)->sortBy(function ($child) { |
|
299 | + return collect($this->childs)->sortBy(function($child) { |
|
300 | 300 | return $child->order; |
301 | 301 | })->all(); |
302 | 302 | } |
@@ -32,6 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * {@inheritdoc }. |
35 | + * @param \Nwidart\Menus\MenuItem $item |
|
35 | 36 | */ |
36 | 37 | public function getActiveState($item, $state = ' class="active"') |
37 | 38 | { |
@@ -41,7 +42,7 @@ discard block |
||
41 | 42 | /** |
42 | 43 | * Get active state on child items. |
43 | 44 | * |
44 | - * @param $item |
|
45 | + * @param \Nwidart\Menus\MenuItem $item |
|
45 | 46 | * @param string $state |
46 | 47 | * |
47 | 48 | * @return null|string |
@@ -42,6 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * {@inheritdoc }. |
45 | + * @param \Nwidart\Menus\MenuItem $item |
|
45 | 46 | */ |
46 | 47 | public function getActiveState($item, $state = ' class="active"') |
47 | 48 | { |
@@ -51,7 +52,7 @@ discard block |
||
51 | 52 | /** |
52 | 53 | * Get active state on child items. |
53 | 54 | * |
54 | - * @param $item |
|
55 | + * @param \Nwidart\Menus\MenuItem $item |
|
55 | 56 | * @param string $state |
56 | 57 | * |
57 | 58 | * @return null|string |
@@ -20,7 +20,7 @@ |
||
20 | 20 | /** @test */ |
21 | 21 | public function it_generates_an_empty_menu() |
22 | 22 | { |
23 | - $this->menu->create('test', function (MenuBuilder $menu) { |
|
23 | + $this->menu->create('test', function(MenuBuilder $menu) { |
|
24 | 24 | }); |
25 | 25 | |
26 | 26 | $expected = <<<TEXT |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $this->registerHtmlPackage(); |
42 | 42 | |
43 | - $this->app['menus'] = $this->app->share(function ($app) { |
|
43 | + $this->app['menus'] = $this->app->share(function($app) { |
|
44 | 44 | return new Menu($app['view'], $app['config']); |
45 | 45 | }); |
46 | 46 | } |