Completed
Pull Request — master (#69)
by
unknown
07:45
created
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/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/MenuItemTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     public function it_can_create_a_dropdown_menu_item()
106 106
     {
107 107
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
108
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
108
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
109 109
             $sub->url('settings/account', 'Account');
110 110
             $sub->url('settings/password', 'Password');
111 111
         });
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function it_can_make_a_simple_route_menu_item()
118 118
     {
119 119
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
120
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
120
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
121 121
             $sub->route('settings.account', 'Account', ['user_id' => 1]);
122 122
         });
123 123
         $children = $menuItem->getChilds()[0]->getChilds();
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     public function it_can_make_a_route_menu_item()
133 133
     {
134 134
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
135
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
135
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
136 136
             $sub->route('settings.account', 'Account', ['user_id' => 1], 1, ['my-attr' => 'value']);
137 137
         });
138 138
         $children = $menuItem->getChilds()[0]->getChilds();
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public function it_can_make_a_simple_url_menu_item()
150 150
     {
151 151
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
152
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
152
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
153 153
             $sub->url('settings/account', 'Account');
154 154
         });
155 155
         $children = $menuItem->getChilds()[0]->getChilds();
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     public function it_can_make_a_url_menu_item()
165 165
     {
166 166
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
167
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
167
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
168 168
             $sub->url('settings/account', 'Account', 1, ['my-attr' => 'value']);
169 169
         });
170 170
         $children = $menuItem->getChilds()[0]->getChilds();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     public function it_can_add_a_menu_item_divider()
182 182
     {
183 183
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
184
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
184
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
185 185
             $sub->url('settings/account', 'Account');
186 186
             $sub->divider();
187 187
         });
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     public function it_can_add_a_header_menu_item()
199 199
     {
200 200
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
201
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
201
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
202 202
             $sub->header('User Stuff');
203 203
             $sub->url('settings/account', 'Account');
204 204
         });
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     {
226 226
         $this->app['router']->get('settings/account', ['as' => 'settings.account']);
227 227
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
228
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
228
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
229 229
             $sub->route('settings.account', 'Account');
230 230
         });
231 231
         $children = $menuItem->getChilds()[0]->getChilds();
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     public function it_can_check_for_a_submenu()
287 287
     {
288 288
         $menuItem = MenuItem::make(['title' => 'Parent Item']);
289
-        $menuItem->dropdown('Dropdown item', function (MenuItem $sub) {
289
+        $menuItem->dropdown('Dropdown item', function(MenuItem $sub) {
290 290
             $sub->header('User Stuff');
291 291
             $sub->url('settings/account', 'Account');
292 292
         });
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->assertStringContainsString('.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/MenuItem.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
             if (($title_or_properties['attributes']??null) === null)
169 169
             {
170
-               $title_or_properties['attributes'] = [];
170
+                $title_or_properties['attributes'] = [];
171 171
             }
172 172
 
173 173
             $properties = $title_or_properties;
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
             // if three args are passed in, third must be attributes
181 181
 
182 182
             if (func_num_args() === 3 && is_array($order)) {
183
-               $attributes = $order;
184
-               $properties = compact('title', 'attributes');
183
+                $attributes = $order;
184
+                $properties = compact('title', 'attributes');
185 185
             }
186 186
             else
187 187
             {
188
-               $properties = compact('title', 'order', 'attributes');
188
+                $properties = compact('title', 'order', 'attributes');
189 189
             }
190 190
         }
191 191
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
     {
166 166
         if (is_array($title_or_properties)) {
167 167
 
168
-            if (($title_or_properties['attributes']??null) === null)
168
+            if (($title_or_properties['attributes'] ?? null) === null)
169 169
             {
170 170
                $title_or_properties['attributes'] = [];
171 171
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -171,8 +171,7 @@  discard block
 block discarded – undo
171 171
             }
172 172
 
173 173
             $properties = $title_or_properties;
174
-        }
175
-        else
174
+        } else
176 175
         {
177 176
             $title = $title_or_properties;
178 177
 
@@ -182,8 +181,7 @@  discard block
 block discarded – undo
182 181
             if (func_num_args() === 3 && is_array($order)) {
183 182
                $attributes = $order;
184 183
                $properties = compact('title', 'attributes');
185
-            }
186
-            else
184
+            } else
187 185
             {
188 186
                $properties = compact('title', 'order', 'attributes');
189 187
             }
Please login to merge, or discard this patch.
src/MenuBuilder.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
             if (($title_or_properties['attributes']??null) === null)
359 359
             {
360
-               $title_or_properties['attributes'] = [];
360
+                $title_or_properties['attributes'] = [];
361 361
             }
362 362
 
363 363
             $properties = $title_or_properties;
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
             // if three args are passed in, third must be attributes
371 371
 
372 372
             if (func_num_args() === 3 && is_array($order)) {
373
-               $attributes = $order;
374
-               $properties = compact('title', 'attributes');
373
+                $attributes = $order;
374
+                $properties = compact('title', 'attributes');
375 375
             }
376 376
             else
377 377
             {
378
-               $properties = compact('title', 'order', 'attributes');
378
+                $properties = compact('title', 'order', 'attributes');
379 379
             }
380 380
 
381 381
             $properties = compact('title', 'order', 'attributes');
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function findBy($key, $value)
127 127
     {
128
-        return collect($this->items)->filter(function ($item) use ($key, $value) {
128
+        return collect($this->items)->filter(function($item) use ($key, $value) {
129 129
             return $item->{$key} == $value;
130 130
         })->first();
131 131
     }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
      */
311 311
     protected function resolveItems(array &$items)
312 312
     {
313
-        $resolver = function ($property) {
313
+        $resolver = function($property) {
314 314
             return $this->resolve($property) ?: $property;
315 315
         };
316 316
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     {
356 356
         if (is_array($title_or_properties)) {
357 357
 
358
-            if (($title_or_properties['attributes']??null) === null)
358
+            if (($title_or_properties['attributes'] ?? null) === null)
359 359
             {
360 360
                $title_or_properties['attributes'] = [];
361 361
             }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
     public function getOrderedItems()
639 639
     {
640 640
         if (config('menus.ordering') || $this->ordering) {
641
-            return $this->toCollection()->sortBy(function ($item) {
641
+            return $this->toCollection()->sortBy(function($item) {
642 642
                 return $item->order;
643 643
             })->all();
644 644
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -361,8 +361,7 @@  discard block
 block discarded – undo
361 361
             }
362 362
 
363 363
             $properties = $title_or_properties;
364
-        }
365
-        else
364
+        } else
366 365
         {
367 366
             $title = $title_or_properties;
368 367
 
@@ -372,8 +371,7 @@  discard block
 block discarded – undo
372 371
             if (func_num_args() === 3 && is_array($order)) {
373 372
                $attributes = $order;
374 373
                $properties = compact('title', 'attributes');
375
-            }
376
-            else
374
+            } else
377 375
             {
378 376
                $properties = compact('title', 'order', 'attributes');
379 377
             }
Please login to merge, or discard this patch.