src/Highlighter.php
public function highlightLines(string $source, int $line, int $around = 5): string
    {
        $lines = explode("\n", str_replace("\r\n", "\n", $this->highlight($source)));

        $result = "";
        foreach ($lines as $number => $code) {
            $human = $number + 1;
            if (!empty($around) && ($human < $line - $around || $human >= $line + $around + 1)) {
                //Not included in a range
                continue;
            }

            $result .= $this->r->line($human, mb_convert_encoding($code, 'utf-8'), $human === $line);
        }

        return $result;
    }
public function highlightLines(string $source, int $line, int $around = 5): string
    {
        $lines = explode("\n", str_replace("\r\n", "\n", $this->highlight($source)));

        $result = "";
        foreach ($lines as $number => $code) {
            $human = $number + 1;
            if (!empty($around) && ($human < $line - $around || $human >= $line + $around + 1)) {
                //Not included in a range
                continue;
            }

            $result .= $this->r->line($human, mb_convert_encoding($code, 'utf-8'), $human === $line);
        }

        return $result;
    }
public function highlightLines ( string $ source , int $ line , int $ around = 5 ) : string { $ lines = explode ( "\n" , str_replace ( "\r\n" , "\n" , $ this -> highlight ( $ source ) ) ) ; $ result = "" ; foreach ( $ lines as $ number => $ code ) { $ human = $ number + 1 ; if ( ! empty ( $ around ) && ( $ human < $ line - $ around || $ human >= $ line + $ around + 1 ) ) { //Not included in a range continue ; } $ result .= $ this -> r -> line ( $ human , mb_convert_encoding ( $ code , 'utf-8' ) , $ human === $ line ) ; } return $ result ; }
Highlight PHP source and return N lines around target line.

@param string $source
@param int    $line
@param int    $around
@return string
Highlight PHP source and return N lines around target line .