Conditions | 7 |
Paths | 1 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function __invoke() |
||
19 | { |
||
20 | return function (): Collection { |
||
21 | if ($this->isEmpty()) { |
||
|
|||
22 | return new static(); |
||
23 | } |
||
24 | |||
25 | $firstItem = $this->first(); |
||
26 | |||
27 | $expectedLength = is_array($firstItem) || $firstItem instanceof Countable ? count($firstItem) : 0; |
||
28 | |||
29 | array_walk($this->items, function ($row) use ($expectedLength) { |
||
30 | if ((is_array($row) || $row instanceof Countable) && count($row) !== $expectedLength) { |
||
31 | throw new \LengthException("Element's length must be equal."); |
||
32 | } |
||
33 | }); |
||
34 | |||
35 | $items = array_map(function (...$items) { |
||
36 | return new static($items); |
||
37 | }, ...array_map(function ($items) { |
||
38 | return $this->getArrayableItems($items); |
||
39 | }, array_values($this->items))); |
||
40 | |||
41 | return new static($items); |
||
42 | }; |
||
43 | } |
||
44 | } |
||
45 |
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.