Conditions | 5 |
Paths | 1 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function __invoke() { |
||
19 | return function ($key, bool $preserveKeys = false, $sectionKey = 0, $itemsKey = 1): Collection { |
||
20 | $sectionNameRetriever = $this->valueRetriever($key); |
||
|
|||
21 | |||
22 | $results = new Collection(); |
||
23 | |||
24 | foreach ($this->items as $key => $value) { |
||
25 | $sectionName = $sectionNameRetriever($value); |
||
26 | |||
27 | if (! $results->last() || $results->last()->get($sectionKey) !== $sectionName) { |
||
28 | $results->push(new Collection([ |
||
29 | $sectionKey => $sectionName, |
||
30 | $itemsKey => new Collection(), |
||
31 | ])); |
||
32 | } |
||
33 | |||
34 | $results->last()->get($itemsKey)->offsetSet($preserveKeys ? $key : null, $value); |
||
35 | } |
||
36 | |||
37 | return $results; |
||
38 | }; |
||
39 | } |
||
40 | } |
||
41 |
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.