| 1 | <?php |
||
| 12 | class SimpleWalker implements WalkerInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * {@inheritdoc} |
||
| 16 | */ |
||
| 17 | 3 | public function goToLine(\SplFileObject $file, $lineNumber) |
|
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | 3 | public function goBeforeCharacter(\SplFileObject $file, $characterNumber) |
|
| 37 | { |
||
| 38 | 3 | $file->rewind(); |
|
| 39 | |||
| 40 | 3 | if ($characterNumber < 0 || $characterNumber > $file->getSize()) { |
|
| 41 | 2 | throw new OutOfBoundsException(); |
|
| 42 | } |
||
| 43 | |||
| 44 | 1 | for ($i = 0; $i <= $characterNumber - 1; $i++) { |
|
| 45 | 1 | $file->fgetc(); |
|
| 46 | 1 | } |
|
| 47 | |||
| 48 | 1 | return $file; |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritdoc} |
||
| 53 | */ |
||
| 54 | 1 | public function countLines(\SplFileObject $file) |
|
| 69 | } |
||
| 70 |