| Conditions | 5 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public function highlightLines(string $source, int $line, int $around = 5): string |
||
| 39 | { |
||
| 40 | $lines = explode("\n", str_replace("\r\n", "\n", $this->highlight($source))); |
||
| 41 | |||
| 42 | $result = ''; |
||
| 43 | foreach ($lines as $number => $code) { |
||
| 44 | $human = $number + 1; |
||
| 45 | if (!empty($around) && ($human < $line - $around || $human >= $line + $around + 1)) { |
||
| 46 | //Not included in a range |
||
| 47 | continue; |
||
| 48 | } |
||
| 49 | |||
| 50 | $result .= $this->r->line($human, mb_convert_encoding($code, 'utf-8'), $human === $line); |
||
| 51 | } |
||
| 52 | |||
| 53 | return $result; |
||
| 54 | } |
||
| 100 |