ZF\Apigility\Admin\Controller\SourceController::highlightFileWithNum PHP Метод

highlightFileWithNum() защищенный Метод

Highlight a PHP source code with line numbers
protected highlightFileWithNum ( string $file ) : string
$file string
Результат string
    protected function highlightFileWithNum($file)
    {
        $code = substr(highlight_file($file, true), 36, -15);
        $lines = explode('<br />', $code);
        $lineCount = count($lines);
        $padLength = strlen($lineCount);
        $code = '<code><span style="color: #000000">';
        foreach ($lines as $i => $line) {
            $lineNumber = str_pad($i + 1, $padLength, '0', STR_PAD_LEFT);
            $code .= sprintf('<br /><span style="color: #999999">%s  </span>%s', $lineNumber, $line);
        }
        $code .= '</span></code>';
        return $code;
    }