Skip to content

Commit 6e2ea14

Browse files
chore(style): fix code style
1 parent e064e26 commit 6e2ea14

File tree

7 files changed

+35
-33
lines changed

7 files changed

+35
-33
lines changed

src/Components/Menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Hexadog\MenusManager\Components;
44

5-
use Illuminate\View\Component;
6-
use Illuminate\Support\Collection;
75
use Hexadog\MenusManager\Facades\Menus;
6+
use Illuminate\Support\Collection;
7+
use Illuminate\View\Component;
88

99
class Menu extends Component
1010
{

src/Facades/MenusManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Hexadog\MenusManager\Facades;
44

5-
use Illuminate\Support\Facades\Facade;
65
use Hexadog\MenusManager\MenusManager as Manager;
6+
use Illuminate\Support\Facades\Facade;
77

88
class MenusManager extends Facade
99
{

src/Item.php

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Hexadog\MenusManager;
44

5-
use Illuminate\Support\Arr;
6-
use Illuminate\Support\Collection;
75
use Hexadog\MenusManager\Traits\HasItems;
86
use Illuminate\Contracts\Support\Arrayable;
7+
use Illuminate\Support\Arr;
8+
use Illuminate\Support\Collection;
99
use Illuminate\Support\Facades\Request;
1010
use Illuminate\Support\Facades\Route;
1111
use Illuminate\Support\Facades\URL;
@@ -28,13 +28,13 @@ class Item implements Arrayable
2828
* @var array
2929
*/
3030
protected $properties = [
31-
'attributes' => [],
32-
'icon' => null,
33-
'order' => 9000,
34-
'route' => null,
35-
'title' => '',
36-
'type' => 'link', // link | divider | header
37-
'url' => null,
31+
'attributes' => [],
32+
'icon' => null,
33+
'order' => 9000,
34+
'route' => null,
35+
'title' => '',
36+
'type' => 'link', // link | divider | header
37+
'url' => null,
3838
];
3939

4040
/**
@@ -101,7 +101,7 @@ public function __set($key, $value)
101101
public function asHeader(): Item
102102
{
103103
return $this->fill([
104-
'type' => 'header'
104+
'type' => 'header',
105105
]);
106106
}
107107

@@ -113,7 +113,7 @@ public function asHeader(): Item
113113
public function asDivider(): Item
114114
{
115115
return $this->fill([
116-
'type' => 'divider'
116+
'type' => 'divider',
117117
]);
118118
}
119119

@@ -194,11 +194,11 @@ public function hasChildren(): bool
194194
/**
195195
* Check if icon is set for the current item
196196
*
197-
* @return boolean
197+
* @return bool
198198
*/
199199
public function hasIcon(): bool
200200
{
201-
return !is_null($this->icon);
201+
return ! is_null($this->icon);
202202
}
203203

204204
/**
@@ -251,7 +251,7 @@ public function isHeader(): bool
251251
*/
252252
public function isHidden(): bool
253253
{
254-
return !$this->isVisible();
254+
return ! $this->isVisible();
255255
}
256256

257257
/**
@@ -289,7 +289,7 @@ public function icon(string $icon): Item
289289
*/
290290
public function if($callback): Item
291291
{
292-
if (!is_callable($callback)) {
292+
if (! is_callable($callback)) {
293293
$callback = function () use ($callback) {
294294
return $callback;
295295
};
@@ -303,7 +303,7 @@ public function if($callback): Item
303303
/**
304304
* Set the current item order
305305
*
306-
* @param integer $order
306+
* @param int $order
307307
*
308308
* @return Item
309309
*/
@@ -367,6 +367,7 @@ private function htmlAttributes($attributes)
367367
if (is_bool($attributes[$key])) {
368368
return $attributes[$key] ? $key : '';
369369
}
370+
370371
return $key . '="' . $attributes[$key] . '"';
371372
}, array_keys($attributes))));
372373
}
@@ -386,7 +387,7 @@ public function toArray()
386387
'order' => $this->order,
387388
'title' => $this->title,
388389
'type' => $this->type,
389-
'url' => $this->getUrl()
390+
'url' => $this->getUrl(),
390391
];
391392
}
392393
}

src/Menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function toArray()
5555
{
5656
return [
5757
'name' => $this->name,
58-
'items' => $this->items->toArray()
58+
'items' => $this->items->toArray(),
5959
];
6060
}
6161
}

src/MenusManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function all(): array
4141
*/
4242
public function register($name): Menu
4343
{
44-
if (!$menu = $this->get($name)) {
44+
if (! $menu = $this->get($name)) {
4545
$menu = new Menu($name);
4646

4747
$this->menus->put($name, $menu);
@@ -60,8 +60,8 @@ public function register($name): Menu
6060
*/
6161
public function __call($method_name, $args)
6262
{
63-
if (!method_exists($this, $method_name)) {
64-
return call_user_func_array(array($this->menus, $method_name), $args);
63+
if (! method_exists($this, $method_name)) {
64+
return call_user_func_array([$this->menus, $method_name], $args);
6565
}
6666
}
6767
}

src/Providers/PackageServiceProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace Hexadog\MenusManager\Providers;
44

5-
use ReflectionClass;
6-
use Illuminate\Support\Str;
7-
use Illuminate\Routing\Router;
85
use Hexadog\MenusManager\Components;
6+
use Hexadog\MenusManager\Facades\Menus as MenusFacade;
7+
use Hexadog\MenusManager\Facades\MenusManager as MenusManagerFacade;
98
use Hexadog\MenusManager\MenusManager;
109
use Illuminate\Foundation\AliasLoader;
10+
use Illuminate\Routing\Router;
1111
use Illuminate\Support\ServiceProvider;
12-
use Hexadog\MenusManager\Facades\Menus as MenusFacade;
13-
use Hexadog\MenusManager\Facades\MenusManager as MenusManagerFacade;
12+
use Illuminate\Support\Str;
13+
use ReflectionClass;
1414

1515
class PackageServiceProvider extends ServiceProvider
1616
{
@@ -69,7 +69,7 @@ public function boot(Router $router)
6969
Components\Header::class,
7070
Components\Icon::class,
7171
Components\Item::class,
72-
Components\Menu::class
72+
Components\Menu::class,
7373
]);
7474
}
7575

src/Traits/HasItems.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function findBy(string $key, string $value): ?Item
6565
*/
6666
public function findByTitleOrAdd(string $title, array $attributes = []): ?Item
6767
{
68-
if (!($item = $this->findBy('title', $title))) {
68+
if (! ($item = $this->findBy('title', $title))) {
6969
$item = $this->add(compact('title', 'attributes'));
7070
}
7171

@@ -110,6 +110,7 @@ public function route($route, string $title, array $attributes = []): Item
110110
{
111111
return $this->add(compact('route', 'title', 'attributes'));
112112
}
113+
113114
/**
114115
* Register new menu item using url
115116
*
@@ -134,8 +135,8 @@ public function url(string $url, string $title, array $attributes = []): Item
134135
*/
135136
public function __call($method_name, $args)
136137
{
137-
if (!method_exists($this, $method_name)) {
138-
return call_user_func_array(array($this->items, $method_name), $args);
138+
if (! method_exists($this, $method_name)) {
139+
return call_user_func_array([$this->items, $method_name], $args);
139140
}
140141
}
141142
}

0 commit comments

Comments
 (0)