Total Complexity | 7 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Coverage | 72.21% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class Shift extends Iterators |
||
16 | { |
||
17 | /** |
||
18 | * Shift constructor. |
||
19 | * |
||
20 | * @param array<int, mixed> $dataset |
||
21 | * The dataset |
||
22 | * @param int $length |
||
23 | * The shift length |
||
24 | */ |
||
25 | public function __construct(array $dataset = [], $length = 1) |
||
26 | { |
||
27 | parent::__construct($dataset, $length); |
||
28 | $this->current = $this->getDataset(); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | public function count() |
||
35 | 12 | { |
|
36 | return count($this->getDataset()); |
||
37 | 12 | } |
|
38 | 12 | ||
39 | 12 | /** |
|
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | public function next() |
||
45 | } |
||
46 | 12 | ||
47 | 12 | /** |
|
48 | * {@inheritdoc} |
||
49 | 12 | */ |
|
50 | public function rewind() |
||
53 | } |
||
54 | |||
55 | 4 | /** |
|
56 | * {@inheritdoc} |
||
57 | 4 | */ |
|
58 | public function valid() |
||
59 | { |
||
60 | return true; |
||
61 | } |
||
62 | |||
63 | 8 | /** |
|
64 | * Internal function to do the shift. |
||
65 | 8 | * |
|
66 | 8 | * @param int $length |
|
67 | */ |
||
68 | protected function doShift($length = 1) |
||
83 | ); |
||
84 | } |
||
85 | } |
||
86 |