Conditions | 2 |
Paths | 1 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
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) { |
||
|
|||
21 | $class = 'Spatie\\CollectionMacros\\Macros\\'.$macro; |
||
22 | |||
23 | $macro = Str::camel($macro); |
||
24 | |||
25 | if($macro === 'tryCatch') { |
||
26 | $macro = 'try'; |
||
27 | } |
||
28 | |||
29 | Collection::macro($macro, app($class)()); |
||
30 | }); |
||
31 | |||
32 | |||
33 | } |
||
34 | } |
||
35 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.