Skip to content

Commit bd875dd

Browse files
gaetan-hexadogactions-user
authored andcommitted
Automatically applied php-cs-fixer changes
1 parent 3a37d09 commit bd875dd

File tree

2 files changed

+23
-54
lines changed

2 files changed

+23
-54
lines changed

src/Providers/PackageServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class PackageServiceProvider extends ServiceProvider
1717
/**
1818
* Our root directory for this package to make traversal easier.
1919
*/
20-
public const PACKAGE_DIR = __DIR__.'/../../';
20+
public const PACKAGE_DIR = __DIR__ . '/../../';
2121

2222
/**
2323
* Name for this package to publish assets.
@@ -80,7 +80,7 @@ protected function getPath($path = '')
8080
// We get the child class
8181
$rc = new ReflectionClass(get_class($this));
8282

83-
return dirname($rc->getFileName()).'/../../'.$path;
83+
return dirname($rc->getFileName()) . '/../../' . $path;
8484
}
8585

8686
/**

src/Traits/HasItems.php

Lines changed: 21 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,27 @@
88
trait HasItems
99
{
1010
/**
11-
* The items collection
11+
* The items collection.
1212
*
1313
* @var Collection
1414
*/
1515
protected $items;
1616

1717
/**
18-
* Add new item
18+
* Magic method to manipulate items Collection with ease.
1919
*
20-
* @param array $attributes
21-
*
22-
* @return Item
20+
* @param string $method_name
21+
* @param array $args
22+
*/
23+
public function __call($method_name, $args)
24+
{
25+
if (!method_exists($this, $method_name)) {
26+
return call_user_func_array([$this->items, $method_name], $args);
27+
}
28+
}
29+
30+
/**
31+
* Add new item.
2332
*/
2433
public function add(array $attributes = []): Item
2534
{
@@ -35,22 +44,15 @@ public function add(array $attributes = []): Item
3544
}
3645

3746
/**
38-
* Add new divider menu item
39-
*
40-
* @param array $attributes
41-
*
42-
* @return Item
47+
* Add new divider menu item.
4348
*/
4449
public function divider(array $attributes = []): Item
4550
{
4651
return $this->add(compact('attributes'))->asDivider();
4752
}
4853

4954
/**
50-
* Find item by key and value
51-
*
52-
* @param string $key
53-
* @param string $value
55+
* Find item by key and value.
5456
*
5557
* @return mixed
5658
*/
@@ -62,10 +64,7 @@ public function findBy(string $key, string $value): ?Item
6264
}
6365

6466
/**
65-
* Find item by given title or add it
66-
*
67-
* @param string $title
68-
* @param array $attributes
67+
* Find item by given title or add it.
6968
*
7069
* @return mixed
7170
*/
@@ -79,20 +78,15 @@ public function findByTitleOrAdd(string $title, array $attributes = []): ?Item
7978
}
8079

8180
/**
82-
* Add new header menu item
83-
*
84-
* @param string $title
85-
* @param array $attributes
86-
*
87-
* @return Item
81+
* Add new header menu item.
8882
*/
8983
public function header(string $title, array $attributes = []): Item
9084
{
9185
return $this->add(compact('title', 'attributes'))->asHeader();
9286
}
9387

9488
/**
95-
* Get items
89+
* Get items.
9690
*
9791
* @return Collection
9892
*/
@@ -104,45 +98,20 @@ public function items()
10498
}
10599

106100
/**
107-
* Register new menu item using registered route
101+
* Register new menu item using registered route.
108102
*
109103
* @param mixed $route
110-
* @param string $title
111-
* @param array $attributes
112-
*
113-
* @return Item
114104
*/
115105
public function route($route, string $title, array $attributes = []): Item
116106
{
117107
return $this->add(compact('route', 'title', 'attributes'));
118108
}
119109

120110
/**
121-
* Register new menu item using url
122-
*
123-
* @param string $url
124-
* @param string $title
125-
* @param array $attributes
126-
*
127-
* @return Item
111+
* Register new menu item using url.
128112
*/
129113
public function url(string $url, string $title, array $attributes = []): Item
130114
{
131115
return $this->add(compact('url', 'title', 'attributes'));
132116
}
133-
134-
/**
135-
* Magic method to manipulate items Collection with ease
136-
*
137-
* @param string $method_name
138-
* @param array $args
139-
*
140-
* @return void
141-
*/
142-
public function __call($method_name, $args)
143-
{
144-
if (!method_exists($this, $method_name)) {
145-
return call_user_func_array([$this->items, $method_name], $args);
146-
}
147-
}
148117
}

0 commit comments

Comments
 (0)