| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 5 | public function seek($position) |
|
| 25 | { |
||
| 26 | 5 | if (!array_key_exists($position, $this->elements)) { |
|
| 27 | 1 | throw new \InvalidArgumentException( |
|
| 28 | 1 | sprintf('Position %s does not exist in collection', $position) |
|
| 29 | 1 | ); |
|
| 30 | } |
||
| 31 | |||
| 32 | 4 | reset($this->elements); |
|
| 33 | |||
| 34 | 4 | while (key($this->elements) !== $position) { |
|
| 35 | 4 | next($this->elements); |
|
| 36 | 4 | } |
|
| 37 | 4 | } |
|
| 38 | } |
||
| 39 |