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