| Total Complexity | 8 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | final class ArrayStream extends \ArrayIterator implements StreamInterface |
||
| 9 | { |
||
| 10 | use StreamTrait; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * ArrayStream constructor. |
||
| 14 | * |
||
| 15 | * @param array $array The array data |
||
| 16 | */ |
||
| 17 | 214 | public function __construct(array $array = []) |
|
| 18 | { |
||
| 19 | 214 | parent::__construct($array); |
|
| 20 | 214 | } |
|
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | */ |
||
| 25 | 28 | public function toArray(bool $preserveKeys = true): array |
|
| 26 | { |
||
| 27 | 28 | $array = $this->getArrayCopy(); |
|
| 28 | |||
| 29 | 28 | return $preserveKeys |
|
| 30 | 20 | ? $array |
|
| 31 | 28 | : array_values($array) |
|
| 32 | ; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritdoc} |
||
| 37 | */ |
||
| 38 | 1 | public function skip(int $count): StreamInterface |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | 1 | public function limit(int $count, int $offset = 0): StreamInterface |
|
| 61 |