Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | 3 | public function goToLine(\SplFileObject $file, $lineNumber) |
|
18 | { |
||
19 | 3 | if ($lineNumber < 0 || $lineNumber > $this->countLines($file)) { |
|
20 | 2 | throw new OutOfBoundsException(); |
|
21 | } |
||
22 | |||
23 | 1 | $file->rewind(); |
|
24 | |||
25 | 1 | for ($i = 0; $i < $lineNumber; $i++) { |
|
26 | 1 | $file->next(); |
|
27 | 1 | $file->current(); |
|
28 | 1 | } |
|
29 | |||
30 | 1 | return $file; |
|
31 | } |
||
32 | |||
70 |