Completed
Push — master ( 14eaec...c0ed6e )
by Nicolas
06:58
created
src/Presenters/Bootstrap/NavbarPresenter.php 1 patch
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/MenuBuilder.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Doc Comments   +13 added lines, -11 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     /**
221 221
      * Determine if the given name in the presenter style.
222 222
      *
223
-     * @param $name
223
+     * @param string|null $name
224 224
      *
225 225
      * @return bool
226 226
      */
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      *
245 245
      * @param $name
246 246
      *
247
-     * @return mixed
247
+     * @return string
248 248
      */
249 249
     public function getStyle($name)
250 250
     {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     /**
257 257
      * Set new presenter class from given alias name.
258 258
      *
259
-     * @param $name
259
+     * @param string|null $name
260 260
      */
261 261
     public function setPresenterFromStyle($name)
262 262
     {
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
      * Create new menu with dropdown.
340 340
      *
341 341
      * @param $title
342
-     * @param callable $callback
342
+     * @param \Closure $callback
343 343
      * @param array    $attributes
344 344
      *
345
-     * @return $this
345
+     * @return MenuItem
346 346
      */
347 347
     public function dropdown($title, \Closure $callback, $order = null, array $attributes = array())
348 348
     {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      * @param array $parameters
375 375
      * @param array $attributes
376 376
      *
377
-     * @return static
377
+     * @return MenuItem
378 378
      */
379 379
     public function route($route, $title, $parameters = array(), $order = null, $attributes = array())
380 380
     {
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
     /**
417 417
      * Register new menu item using url.
418 418
      *
419
-     * @param $url
420
-     * @param $title
419
+     * @param string $url
420
+     * @param string $title
421 421
      * @param array $attributes
422 422
      *
423
-     * @return static
423
+     * @return MenuItem
424 424
      */
425 425
     public function url($url, $title, $order = 0, $attributes = array())
426 426
     {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
      * Add new divider item.
448 448
      *
449 449
      * @param int $order
450
-     * @return \Nwidart\Menus\MenuItem
450
+     * @return MenuBuilder
451 451
      */
452 452
     public function addDivider($order = null)
453 453
     {
@@ -459,7 +459,8 @@  discard block
 block discarded – undo
459 459
     /**
460 460
      * Add new header item.
461 461
      *
462
-     * @return \Nwidart\Menus\MenuItem
462
+     * @param string $title
463
+     * @return MenuBuilder
463 464
      */
464 465
     public function addHeader($title, $order = null)
465 466
     {
@@ -543,6 +544,7 @@  discard block
 block discarded – undo
543 544
     /**
544 545
      * Render menu via view presenter.
545 546
      *
547
+     * @param string $presenter
546 548
      * @return \Illuminate\View\View
547 549
      */
548 550
     public function renderView($presenter = null)
Please login to merge, or discard this patch.
src/Menu.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Presenters/Bootstrap/SidebarMenuPresenter.php 1 patch
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/MenuItem.php 1 patch
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
     /**
149 149
      * Register new child menu with dropdown.
150 150
      *
151
-     * @param $title
152
-     * @param callable $callback
151
+     * @param string $title
152
+     * @param Closure $callback
153 153
      *
154 154
      * @return $this
155 155
      */
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
     /**
179 179
      * Create new menu item and set the action to route.
180 180
      *
181
-     * @param $route
182
-     * @param $title
181
+     * @param string $route
182
+     * @param string $title
183 183
      * @param array $parameters
184 184
      * @param array $attributes
185 185
      *
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
     /**
206 206
      * Create new menu item  and set the action to url.
207 207
      *
208
-     * @param $url
209
-     * @param $title
208
+     * @param string $url
209
+     * @param string $title
210 210
      * @param array $attributes
211 211
      *
212 212
      * @return MenuItem
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     /**
291 291
      * Same with "addHeader" method.
292 292
      *
293
-     * @param $title
293
+     * @param string $title
294 294
      *
295 295
      * @return $this
296 296
      */
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
     /**
404 404
      * Check is the current item divider.
405 405
      *
406
-     * @param $name
406
+     * @param string $name
407 407
      *
408 408
      * @return bool
409 409
      */
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
     /**
436 436
      * Check the active state for current menu.
437 437
      *
438
-     * @return mixed
438
+     * @return boolean
439 439
      */
440 440
     public function hasActiveOnChild()
441 441
     {
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
      * Set hide condition for current menu item.
588 588
      *
589 589
      * @param  Closure
590
-     * @return boolean
590
+     * @return MenuItem
591 591
      */
592 592
     public function hideWhen(Closure $callback)
593 593
     {
Please login to merge, or discard this patch.
src/MenusServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     {
41 41
         $this->registerHtmlPackage();
42 42
 
43
-        $this->app->singleton('menus', function ($app) {
43
+        $this->app->singleton('menus', function($app) {
44 44
             return new Menu($app['view'], $app['config']);
45 45
         });
46 46
     }
Please login to merge, or discard this patch.
Tests/MenuTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     /** @test */
38 38
     public function it_makes_is_an_alias_for_create()
39 39
     {
40
-        $this->menu->make('test', function (MenuBuilder $menu) {
40
+        $this->menu->make('test', function(MenuBuilder $menu) {
41 41
         });
42 42
 
43 43
         $expected = <<<TEXT
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     /** @test */
55 55
     public function it_render_is_an_alias_of_get()
56 56
     {
57
-        $this->menu->make('test', function (MenuBuilder $menu) {
57
+        $this->menu->make('test', function(MenuBuilder $menu) {
58 58
         });
59 59
 
60 60
         $expected = <<<TEXT
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     /** @test */
72 72
     public function it_can_get_the_instance_of_a_menu()
73 73
     {
74
-        $this->menu->create('test', function (MenuBuilder $menu) {
74
+        $this->menu->create('test', function(MenuBuilder $menu) {
75 75
         });
76 76
 
77 77
         $this->assertInstanceOf(MenuBuilder::class, $this->menu->instance('test'));
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
     /** @test */
81 81
     public function it_can_modify_a_menu_instance()
82 82
     {
83
-        $this->menu->create('test', function (MenuBuilder $menu) {
83
+        $this->menu->create('test', function(MenuBuilder $menu) {
84 84
         });
85 85
 
86
-        $this->menu->modify('test', function (MenuBuilder $builder) {
86
+        $this->menu->modify('test', function(MenuBuilder $builder) {
87 87
             $builder->url('hello', 'world');
88 88
         });
89 89
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     /** @test */
94 94
     public function it_gets_a_partial_for_dropdown_styles()
95 95
     {
96
-        $this->menu->create('test', function (MenuBuilder $menu) {
96
+        $this->menu->create('test', function(MenuBuilder $menu) {
97 97
         });
98 98
 
99 99
         $this->assertContains('.dropdown-submenu', $this->menu->style());
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
     /** @test */
103 103
     public function it_can_get_all_menus()
104 104
     {
105
-        $this->menu->create('main', function (MenuBuilder $menu) {
105
+        $this->menu->create('main', function(MenuBuilder $menu) {
106 106
         });
107
-        $this->menu->create('footer', function (MenuBuilder $menu) {
107
+        $this->menu->create('footer', function(MenuBuilder $menu) {
108 108
         });
109 109
 
110 110
         $this->assertCount(2, $this->menu->all());
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
     /** @test */
114 114
     public function it_can_count_menus()
115 115
     {
116
-        $this->menu->create('main', function (MenuBuilder $menu) {
116
+        $this->menu->create('main', function(MenuBuilder $menu) {
117 117
         });
118
-        $this->menu->create('footer', function (MenuBuilder $menu) {
118
+        $this->menu->create('footer', function(MenuBuilder $menu) {
119 119
         });
120 120
 
121 121
         $this->assertEquals(2, $this->menu->count());
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
     /** @test */
125 125
     public function it_can_destroy_all_menus()
126 126
     {
127
-        $this->menu->create('main', function (MenuBuilder $menu) {
127
+        $this->menu->create('main', function(MenuBuilder $menu) {
128 128
         });
129
-        $this->menu->create('footer', function (MenuBuilder $menu) {
129
+        $this->menu->create('footer', function(MenuBuilder $menu) {
130 130
         });
131 131
 
132 132
         $this->assertCount(2, $this->menu->all());
Please login to merge, or discard this patch.
src/Presenters/Admin/AdminltePresenter.php 1 patch
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Presenters/Foundation/ZurbMenuPresenter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function getMenuWithoutDropdownWrapper($item)
30 30
     {
31
-        return '<li'.$this->getActiveState($item).'><a href="'. $item->getUrl() .'">'.$item->title.'</a></li>';
31
+        return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '">' . $item->title . '</a></li>';
32 32
     }
33 33
 
34 34
     /**
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
     public function getMenuWithDropDownWrapper($item)
54 54
     {
55 55
         return '<li class="dropdown dropdown-primary">
56
-                    <a class="dropdown-toggle" href="#">'.$item->title.'</a>
56
+                    <a class="dropdown-toggle" href="#">'.$item->title . '</a>
57 57
                     <ul class="menu">
58
-                      '.$this->getChildMenuItems($item).'
58
+                      '.$this->getChildMenuItems($item) . '
59 59
                     </ul>
60 60
                 </li>' . PHP_EOL;
61 61
     }
Please login to merge, or discard this patch.