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\Macros; |
||
4 | |||
5 | use Illuminate\Support\Collection; |
||
6 | |||
7 | /* |
||
8 | * Join all items from the collection using a string. The final items can use a separate glue string. |
||
9 | * |
||
10 | */ |
||
11 | class Join |
||
12 | { |
||
13 | public function __invoke() |
||
14 | { |
||
15 | return function (string $glue, string $finalGlue = ''): string { |
||
16 | if ($finalGlue === '') { |
||
17 | return $this->implode($glue); |
||
0 ignored issues
–
show
|
|||
18 | }; |
||
19 | |||
20 | if ($this->count() === 0) { |
||
0 ignored issues
–
show
The method
count() does not seem to exist on object<Spatie\CollectionMacros\Macros\Join> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
21 | return ''; |
||
22 | } |
||
23 | |||
24 | if ($this->count() === 1) { |
||
25 | return $this->last(); |
||
26 | } |
||
27 | |||
28 | $collection = new Collection($this->items); |
||
29 | |||
30 | $finalItem = $collection->pop(); |
||
31 | |||
32 | return $collection->implode($glue).$finalGlue.$finalItem; |
||
33 | }; |
||
34 | } |
||
35 | } |
||
36 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.