Passed
Push — master ( d587da...cf8ef6 )
by Kyle
02:42
created
src/Presenters/Bootstrap/NavbarPresenter.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function getOpenTagWrapper(): ?string
14 14
     {
15
-        return PHP_EOL . '<ul class="nav navbar-nav">' . PHP_EOL;
15
+        return PHP_EOL.'<ul class="nav navbar-nav">'.PHP_EOL;
16 16
     }
17 17
 
18 18
     /**
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function getCloseTagWrapper(): ?string
22 22
     {
23
-        return PHP_EOL . '</ul>' . PHP_EOL;
23
+        return PHP_EOL.'</ul>'.PHP_EOL;
24 24
     }
25 25
 
26 26
     /**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function getMenuWithoutDropdownWrapper(MenuItemContract $item): ?string
30 30
     {
31
-        return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' ' . $item->title . '</a></li>' . PHP_EOL;
31
+        return '<li'.$this->getActiveState($item).'><a href="'.$item->getUrl().'" '.$item->getAttributes().'>'.$item->getIcon().' '.$item->title.'</a></li>'.PHP_EOL;
32 32
     }
33 33
 
34 34
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getHeaderWrapper(MenuItemContract $item): ?string
67 67
     {
68
-        return '<li class="dropdown-header">' . $item->title . '</li>';
68
+        return '<li class="dropdown-header">'.$item->title.'</li>';
69 69
     }
70 70
 
71 71
     /**
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function getMenuWithDropDownWrapper(MenuItemContract $item): ?string
75 75
     {
76
-        return '<li class="dropdown' . $this->getActiveStateOnChild($item, ' active') . '">
76
+        return '<li class="dropdown'.$this->getActiveStateOnChild($item, ' active').'">
77 77
 		          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
78
-					' . $item->getIcon() . ' ' . $item->title . '
78
+					' . $item->getIcon().' '.$item->title.'
79 79
 			      	<b class="caret"></b>
80 80
 			      </a>
81 81
 			      <ul class="dropdown-menu">
82
-			      	' . $this->getChildMenuItems($item) . '
82
+			      	' . $this->getChildMenuItems($item).'
83 83
 			      </ul>
84 84
 		      	</li>'
85 85
         . PHP_EOL;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function getMultiLevelDropdownWrapper(MenuItemContract $item): string
96 96
     {
97
-        return '<li class="dropdown' . $this->getActiveStateOnChild($item, ' active') . '">
97
+        return '<li class="dropdown'.$this->getActiveStateOnChild($item, ' active').'">
98 98
 		          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
99
-					' . $item->getIcon() . ' ' . $item->title . '
99
+					' . $item->getIcon().' '.$item->title.'
100 100
 			      	<b class="caret pull-right caret-right"></b>
101 101
 			      </a>
102 102
 			      <ul class="dropdown-menu">
103
-			      	' . $this->getChildMenuItems($item) . '
103
+			      	' . $this->getChildMenuItems($item).'
104 104
 			      </ul>
105 105
 		      	</li>'
106 106
         . PHP_EOL;
Please login to merge, or discard this patch.
src/Presenters/Admin/AdminltePresenter.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     public function getOpenTagWrapper(): ?string
14 14
     {
15
-        return PHP_EOL . '<ul class="sidebar-menu tree" data-widget="tree">' . PHP_EOL;
15
+        return PHP_EOL.'<ul class="sidebar-menu tree" data-widget="tree">'.PHP_EOL;
16 16
     }
17 17
 
18 18
     /**
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function getCloseTagWrapper(): ?string
22 22
     {
23
-        return PHP_EOL . '</ul>' . PHP_EOL;
23
+        return PHP_EOL.'</ul>'.PHP_EOL;
24 24
     }
25 25
 
26 26
     /**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function getMenuWithoutDropdownWrapper(MenuItemContract $item): ?string
30 30
     {
31
-        return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' <span>' . $item->title . '</span></a></li>' . PHP_EOL;
31
+        return '<li'.$this->getActiveState($item).'><a href="'.$item->getUrl().'" '.$item->getAttributes().'>'.$item->getIcon().' <span>'.$item->title.'</span></a></li>'.PHP_EOL;
32 32
     }
33 33
 
34 34
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getHeaderWrapper(MenuItemContract $item): ?string
67 67
     {
68
-        return '<li class="header">' . $item->title . '</li>';
68
+        return '<li class="header">'.$item->title.'</li>';
69 69
     }
70 70
 
71 71
     /**
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function getMenuWithDropDownWrapper(MenuItemContract $item): ?string
75 75
     {
76
-        return '<li class="treeview' . $this->getActiveStateOnChild($item, ' active') . '">
76
+        return '<li class="treeview'.$this->getActiveStateOnChild($item, ' active').'">
77 77
 		          <a href="#">
78
-					' . $item->getIcon() . ' <span>' . $item->title . '</span>
78
+					' . $item->getIcon().' <span>'.$item->title.'</span>
79 79
                     <span class="pull-right-container">
80 80
                       <i class="fa fa-angle-left pull-right"></i>
81 81
                     </span>
82 82
 			      </a>
83 83
 			      <ul class="treeview-menu">
84
-			      	' . $this->getChildMenuItems($item) . '
84
+			      	' . $this->getChildMenuItems($item).'
85 85
 			      </ul>
86 86
 		      	</li>'
87 87
         . PHP_EOL;
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function getMultiLevelDropdownWrapper(MenuItemContract $item): string
98 98
     {
99
-        return '<li class="treeview' . $this->getActiveStateOnChild($item, ' active') . '">
99
+        return '<li class="treeview'.$this->getActiveStateOnChild($item, ' active').'">
100 100
 		          <a href="#">
101
-					' . $item->getIcon() . ' <span>' . $item->title . '</span>
101
+					' . $item->getIcon().' <span>'.$item->title.'</span>
102 102
 			      	<span class="pull-right-container">
103 103
                       <i class="fa fa-angle-left pull-right"></i>
104 104
                     </span>
105 105
 			      </a>
106 106
 			      <ul class="treeview-menu">
107
-			      	' . $this->getChildMenuItems($item) . '
107
+			      	' . $this->getChildMenuItems($item).'
108 108
 			      </ul>
109 109
 		      	</li>'
110 110
         . PHP_EOL;
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
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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->getChildren()[0]->getChilds();
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
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->getChildren()[0]->getChilds();
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
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->getChildren()[0]->getChilds();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
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->getChildren()[0]->getChilds();
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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->getChildren()[0]->getChilds();
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
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
         });
Please login to merge, or discard this patch.
src/Contracts/MenuItemContract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 
136 136
     abstract public function getBadge(): string;
137 137
 
138
-    abstract public function getIcon(null|string $default): ?string;
138
+    abstract public function getIcon(null | string $default): ?string;
139 139
 
140 140
     abstract public function getProperties(): array;
141 141
 
Please login to merge, or discard this patch.
src/MenusServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $this->registerSpatieHtmlPackage();
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/MenuItem.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         if ($this->hasBadge()) {
278 278
             extract($this->badge);
279 279
 
280
-            return '<span class="' . $type . '">' . $text . '</span>';
280
+            return '<span class="'.$type.'">'.$text.'</span>';
281 281
         }
282 282
     }
283 283
 
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
     public function getIcon(string $default = null): ?string
292 292
     {
293 293
         if ($this->icon !== null && $this->icon !== '') {
294
-            return '<i class="' . $this->icon . '"></i>';
294
+            return '<i class="'.$this->icon.'"></i>';
295 295
         }
296 296
         if ($default === null) {
297 297
             return $default;
298 298
         }
299 299
 
300
-        return '<i class="' . $default . '"></i>';
300
+        return '<i class="'.$default.'"></i>';
301 301
     }
302 302
 
303 303
     /**
@@ -322,17 +322,17 @@  discard block
 block discarded – undo
322 322
         Arr::forget($attributes, ['active', 'icon']);
323 323
 
324 324
         $attributeString = collect($attributes)
325
-            ->map(function ($value, $key) {
325
+            ->map(function($value, $key) {
326 326
                 if (is_bool($value)) {
327 327
                     return $value ? $key : '';
328 328
                 }
329 329
 
330
-                return $key . '="' . e($value) . '"';
330
+                return $key.'="'.e($value).'"';
331 331
             })
332 332
             ->filter()
333 333
             ->implode(' ');
334 334
 
335
-        return $attributeString ? ' ' . $attributeString : '';
335
+        return $attributeString ? ' '.$attributeString : '';
336 336
     }
337 337
 
338 338
     /**
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
      */
520 520
     protected function getActiveStateFromRoute(): bool
521 521
     {
522
-        return Request::is(str_replace(url('/') . '/', '', $this->getUrl()));
522
+        return Request::is(str_replace(url('/').'/', '', $this->getUrl()));
523 523
     }
524 524
 
525 525
     /**
Please login to merge, or discard this patch.
app/Support/menus.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 // Define routes first to ensure they exist before menu creation
9 9
 // These should typically be in your routes file, but for demonstration:
10 10
 if (!Route::has('login')) {
11
-    Route::get('/login', function () {
11
+    Route::get('/login', function() {
12 12
         return view('auth.login');
13 13
     })->name('login');
14 14
 }
15 15
 
16 16
 // Create menu after routes are defined
17
-Menu::create('main-guest', function (MenuBuilder $menu) {
17
+Menu::create('main-guest', function(MenuBuilder $menu) {
18 18
     $menu->setPresenter(MainMenuPresenter::class);
19 19
     $menu->add([
20 20
         'route' => 'login',
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 });
25 25
 
26 26
 // You can also create additional menus
27
-Menu::create('main-auth', function (MenuBuilder $menu) {
27
+Menu::create('main-auth', function(MenuBuilder $menu) {
28 28
     $menu->setPresenter(MainMenuPresenter::class);
29 29
     $menu->add([
30 30
         'url' => '/dashboard',
Please login to merge, or discard this patch.