| Conditions | 4 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public static function getLines($filePath, $line, $fetchLineCount) |
||
| 16 | { |
||
| 17 | $lines = []; |
||
| 18 | |||
| 19 | $startLine = $line > 0 ? $line : 0; |
||
| 20 | $endLine = $startLine + $fetchLineCount; |
||
| 21 | |||
| 22 | $file = new SplFileObject($filePath); |
||
| 23 | $file->setFlags(SplFileObject::DROP_NEW_LINE); |
||
| 24 | $file->seek($startLine); |
||
| 25 | |||
| 26 | for ($i = $startLine; $i < $endLine; $i++) { |
||
| 27 | $line = $file->current(); |
||
| 28 | |||
| 29 | if ($line === false) { |
||
| 30 | break; |
||
| 31 | } |
||
| 32 | |||
| 33 | $lines[$i] = $line; |
||
| 34 | $file->next(); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $lines; |
||
| 38 | } |
||
| 39 | } |