| @@ 70-87 (lines=18) @@ | ||
| 67 | /** |
|
| 68 | * {@inheritdoc} |
|
| 69 | */ |
|
| 70 | public function next() |
|
| 71 | { |
|
| 72 | $length = $this->getLength(); |
|
| 73 | $parameters = []; |
|
| 74 | ||
| 75 | if ($length < 0) { |
|
| 76 | $parameters[] = ['start' => abs($length), 'end' => null]; |
|
| 77 | $parameters[] = ['start' => 0, 'end' => abs($length)]; |
|
| 78 | } else { |
|
| 79 | $parameters[] = ['start' => -1 * $length, 'end' => null]; |
|
| 80 | $parameters[] = ['start' => 0, 'end' => $this->datasetCount + $length * -1]; |
|
| 81 | } |
|
| 82 | ||
| 83 | $this->current = array_merge( |
|
| 84 | array_slice($this->current, $parameters[0]['start'], $parameters[0]['end']), |
|
| 85 | array_slice($this->current, $parameters[1]['start'], $parameters[1]['end']) |
|
| 86 | ); |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * {@inheritdoc} |
|
| @@ 92-109 (lines=18) @@ | ||
| 89 | /** |
|
| 90 | * {@inheritdoc} |
|
| 91 | */ |
|
| 92 | public function rewind() |
|
| 93 | { |
|
| 94 | $length = -1 * $this->getLength(); |
|
| 95 | $parameters = []; |
|
| 96 | ||
| 97 | if ($length < 0) { |
|
| 98 | $parameters[] = ['start' => abs($length), 'end' => null]; |
|
| 99 | $parameters[] = ['start' => 0, 'end' => abs($length)]; |
|
| 100 | } else { |
|
| 101 | $parameters[] = ['start' => -1 * $length, 'end' => null]; |
|
| 102 | $parameters[] = ['start' => 0, 'end' => $this->datasetCount + $length * -1]; |
|
| 103 | } |
|
| 104 | ||
| 105 | $this->current = array_merge( |
|
| 106 | array_slice($this->current, $parameters[0]['start'], $parameters[0]['end']), |
|
| 107 | array_slice($this->current, $parameters[1]['start'], $parameters[1]['end']) |
|
| 108 | ); |
|
| 109 | } |
|
| 110 | ||
| 111 | /** |
|
| 112 | * {@inheritdoc} |
|