Conditions | 5 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function chunk(int $size, array $options = []): self |
||
21 | { |
||
22 | if (!empty($options['preserveKeys'])) { |
||
23 | $this->array = array_chunk($this->array, $size, $options['preserveKeys']); |
||
|
|||
24 | } else { |
||
25 | $this->array = array_chunk($this->array, $size); |
||
26 | } |
||
27 | |||
28 | if (empty($options['decorate']) || true === $options['decorate']) { |
||
29 | foreach ($this->array as $index => $chunk) { |
||
30 | $this->array[$index] = new static($chunk); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | return $this; |
||
35 | } |
||
37 |