@@ -361,10 +361,10 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public function getBadge() |
363 | 363 | { |
364 | - if($this->hasBadge()) { |
|
364 | + if ($this->hasBadge()) { |
|
365 | 365 | extract($this->badge); |
366 | 366 | |
367 | - return '<span class="' . $type . '">' . $text . '</span>'; |
|
367 | + return '<span class="'.$type.'">'.$text.'</span>'; |
|
368 | 368 | } |
369 | 369 | //dd('badge is null'); |
370 | 370 | } |
@@ -379,13 +379,13 @@ discard block |
||
379 | 379 | public function getIcon($default = null) |
380 | 380 | { |
381 | 381 | if ($this->icon !== null && $this->icon !== '') { |
382 | - return '<i class="' . $this->icon . '"></i>'; |
|
382 | + return '<i class="'.$this->icon.'"></i>'; |
|
383 | 383 | } |
384 | 384 | if ($default === null) { |
385 | 385 | return $default; |
386 | 386 | } |
387 | 387 | |
388 | - return '<i class="' . $default . '"></i>'; |
|
388 | + return '<i class="'.$default.'"></i>'; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | protected function getActiveStateFromRoute() |
592 | 592 | { |
593 | - return Request::is(str_replace(url('/') . '/', '', $this->getUrl())); |
|
593 | + return Request::is(str_replace(url('/').'/', '', $this->getUrl())); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
@@ -40,7 +40,7 @@ discard block |
||
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 | } |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function registerNamespaces() |
77 | 77 | { |
78 | - $configPath = __DIR__ . '/../config/config.php'; |
|
79 | - $viewsPath = __DIR__ . '/../views'; |
|
78 | + $configPath = __DIR__.'/../config/config.php'; |
|
79 | + $viewsPath = __DIR__.'/../views'; |
|
80 | 80 | $this->mergeConfigFrom($configPath, 'menus'); |
81 | 81 | $this->loadViewsFrom($viewsPath, 'menus'); |
82 | 82 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function findBy($key, $value) |
129 | 129 | { |
130 | - return collect($this->items)->filter(function ($item) use ($key, $value) { |
|
130 | + return collect($this->items)->filter(function($item) use ($key, $value) { |
|
131 | 131 | return $item->{$key} == $value; |
132 | 132 | })->first(); |
133 | 133 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | preg_match_all('/{[\s]*?([^\s]+)[\s]*?}/i', $key, $matches, PREG_SET_ORDER); |
297 | 297 | foreach ($matches as $match) { |
298 | 298 | if (array_key_exists($match[1], $this->bindings)) { |
299 | - $key = preg_replace('/' . $match[0] . '/', $this->bindings[$match[1]], $key, 1); |
|
299 | + $key = preg_replace('/'.$match[0].'/', $this->bindings[$match[1]], $key, 1); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | protected function resolveItems(array &$items) |
314 | 314 | { |
315 | - $resolver = function ($property) { |
|
315 | + $resolver = function($property) { |
|
316 | 316 | return $this->resolve($property) ?: $property; |
317 | 317 | }; |
318 | 318 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | protected function formatUrl($url) |
413 | 413 | { |
414 | - $uri = !is_null($this->prefixUrl) ? $this->prefixUrl . $url : $url; |
|
414 | + $uri = !is_null($this->prefixUrl) ? $this->prefixUrl.$url : $url; |
|
415 | 415 | |
416 | 416 | return $uri == '/' ? '/' : ltrim(rtrim($uri, '/'), '/'); |
417 | 417 | } |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | public function getOrderedItems() |
629 | 629 | { |
630 | 630 | if (config('menus.ordering') || $this->ordering) { |
631 | - return $this->toCollection()->sortBy(function ($item) { |
|
631 | + return $this->toCollection()->sortBy(function($item) { |
|
632 | 632 | return $item->order; |
633 | 633 | })->all(); |
634 | 634 | } |
@@ -20,7 +20,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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()); |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | /** @test */ |
138 | 138 | public function it_still_generates_empty_menu_after_adding_dropdown() |
139 | 139 | { |
140 | - $this->menu->create('test', function (MenuBuilder $menu) { |
|
141 | - $menu->dropdown('Test', function ($sub) { |
|
140 | + $this->menu->create('test', function(MenuBuilder $menu) { |
|
141 | + $menu->dropdown('Test', function($sub) { |
|
142 | 142 | |
143 | - })->hideWhen(function () { |
|
143 | + })->hideWhen(function() { |
|
144 | 144 | return true; |
145 | 145 | }); |
146 | 146 | }); |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | /** @test */ |
160 | 160 | public function it_still_generates_empty_menu_after_adding_item() |
161 | 161 | { |
162 | - $this->menu->create('test', function (MenuBuilder $menu) { |
|
162 | + $this->menu->create('test', function(MenuBuilder $menu) { |
|
163 | 163 | $menu->url('/', 'Test') |
164 | - ->hideWhen(function () { |
|
164 | + ->hideWhen(function() { |
|
165 | 165 | return true; |
166 | 166 | }); |
167 | 167 | }); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function it_can_create_a_dropdown_menu_item() |
107 | 107 | { |
108 | 108 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
109 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
109 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
110 | 110 | $sub->url('settings/account', 'Account'); |
111 | 111 | $sub->url('settings/password', 'Password'); |
112 | 112 | }); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function it_can_make_a_simple_route_menu_item() |
119 | 119 | { |
120 | 120 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
121 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
121 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
122 | 122 | $sub->route('settings.account', 'Account', ['user_id' => 1]); |
123 | 123 | }); |
124 | 124 | $children = $menuItem->getChilds()[0]->getChilds(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function it_can_make_a_route_menu_item() |
134 | 134 | { |
135 | 135 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
136 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
136 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
137 | 137 | $sub->route('settings.account', 'Account', ['user_id' => 1], 1, ['my-attr' => 'value']); |
138 | 138 | }); |
139 | 139 | $children = $menuItem->getChilds()[0]->getChilds(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | public function it_can_make_a_simple_url_menu_item() |
151 | 151 | { |
152 | 152 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
153 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
153 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
154 | 154 | $sub->url('settings/account', 'Account'); |
155 | 155 | }); |
156 | 156 | $children = $menuItem->getChilds()[0]->getChilds(); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function it_can_make_a_url_menu_item() |
166 | 166 | { |
167 | 167 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
168 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
168 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
169 | 169 | $sub->url('settings/account', 'Account', 1, ['my-attr' => 'value']); |
170 | 170 | }); |
171 | 171 | $children = $menuItem->getChilds()[0]->getChilds(); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | public function it_can_add_a_menu_item_divider() |
183 | 183 | { |
184 | 184 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
185 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
185 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
186 | 186 | $sub->url('settings/account', 'Account'); |
187 | 187 | $sub->divider(); |
188 | 188 | }); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public function it_can_add_a_header_menu_item() |
200 | 200 | { |
201 | 201 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
202 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
202 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
203 | 203 | $sub->header('User Stuff'); |
204 | 204 | $sub->url('settings/account', 'Account'); |
205 | 205 | }); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $this->app['router']->get('settings/account', ['as' => 'settings.account']); |
228 | 228 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
229 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
229 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
230 | 230 | $sub->route('settings.account', 'Account'); |
231 | 231 | }); |
232 | 232 | $children = $menuItem->getChilds()[0]->getChilds(); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | public function it_can_check_for_a_submenu() |
288 | 288 | { |
289 | 289 | $menuItem = MenuItem::make(['title' => 'Parent Item']); |
290 | - $menuItem->dropdown('Dropdown item', function (MenuItem $sub) { |
|
290 | + $menuItem->dropdown('Dropdown item', function(MenuItem $sub) { |
|
291 | 291 | $sub->header('User Stuff'); |
292 | 292 | $sub->url('settings/account', 'Account'); |
293 | 293 | }); |