These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Spatie\CollectionMacros; |
||
4 | |||
5 | use Illuminate\Support\Str; |
||
6 | use Illuminate\Support\Collection; |
||
7 | use Illuminate\Support\ServiceProvider; |
||
8 | |||
9 | class CollectionMacroServiceProvider extends ServiceProvider |
||
10 | { |
||
11 | public function register() |
||
12 | { |
||
13 | Collection::make(glob(__DIR__.'/Macros/*.php')) |
||
14 | ->mapWithKeys(function ($path) { |
||
15 | return [$path => pathinfo($path, PATHINFO_FILENAME)]; |
||
16 | }) |
||
17 | ->reject(function ($macro) { |
||
18 | return Collection::hasMacro($macro); |
||
19 | }) |
||
20 | ->each(function ($macro, $path) { |
||
0 ignored issues
–
show
|
|||
21 | $class = 'Spatie\\CollectionMacros\\Macros\\'.$macro; |
||
22 | Collection::macro(Str::camel($macro), app($class)()); |
||
23 | }); |
||
24 | } |
||
25 | } |
||
26 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.