Documentation

Highlighter
in package

Table of Contents

ACTUAL_LINE_MARK  = 'actual_line_mark'
LINE_NUMBER  = 'line_number'
TOKEN_COMMENT  = 'token_comment'
TOKEN_DEFAULT  = 'token_default'
TOKEN_HTML  = 'token_html'
TOKEN_KEYWORD  = 'token_keyword'
TOKEN_STRING  = 'token_string'
$color  : ConsoleColor
$defaultTheme  : array<string|int, mixed>
__construct()  : mixed
getCodeSnippet()  : string
getWholeFile()  : string
getWholeFileWithLineNumbers()  : string
colorLines()  : array<string|int, mixed>
getHighlightedLines()  : array<string|int, mixed>
lineNumbers()  : string
splitToLines()  : array<string|int, mixed>
tokenize()  : array<string|int, mixed>

Constants

ACTUAL_LINE_MARK

public mixed ACTUAL_LINE_MARK = 'actual_line_mark'

LINE_NUMBER

public mixed LINE_NUMBER = 'line_number'

TOKEN_COMMENT

public mixed TOKEN_COMMENT = 'token_comment'

TOKEN_DEFAULT

public mixed TOKEN_DEFAULT = 'token_default'

TOKEN_KEYWORD

public mixed TOKEN_KEYWORD = 'token_keyword'

TOKEN_STRING

public mixed TOKEN_STRING = 'token_string'

Properties

$defaultTheme

private array<string|int, mixed> $defaultTheme = array(self::TOKEN_STRING => 'red', self::TOKEN_COMMENT => 'yellow', self::TOKEN_KEYWORD => 'green', self::TOKEN_DEFAULT => 'default', self::TOKEN_HTML => 'cyan', self::ACTUAL_LINE_MARK => 'red', self::LINE_NUMBER => 'dark_gray')

Methods

getCodeSnippet()

public getCodeSnippet(string $source, int $lineNumber[, int $linesBefore = 2 ][, int $linesAfter = 2 ]) : string
Parameters
$source : string
$lineNumber : int
$linesBefore : int = 2
$linesAfter : int = 2
Tags
throws
InvalidStyleException
throws
InvalidArgumentException
Return values
string

getWholeFile()

public getWholeFile(string $source) : string
Parameters
$source : string
Tags
throws
InvalidStyleException
throws
InvalidArgumentException
Return values
string

getWholeFileWithLineNumbers()

public getWholeFileWithLineNumbers(string $source) : string
Parameters
$source : string
Tags
throws
InvalidStyleException
throws
InvalidArgumentException
Return values
string

colorLines()

private colorLines(array<string|int, mixed> $tokenLines) : array<string|int, mixed>
Parameters
$tokenLines : array<string|int, mixed>
Tags
throws
InvalidStyleException
throws
InvalidArgumentException
Return values
array<string|int, mixed>

getHighlightedLines()

private getHighlightedLines(string $source) : array<string|int, mixed>
Parameters
$source : string
Return values
array<string|int, mixed>

lineNumbers()

private lineNumbers(array<string|int, mixed> $lines[, null|int $markLine = null ]) : string
Parameters
$lines : array<string|int, mixed>
$markLine : null|int = null
Tags
throws
InvalidStyleException
Return values
string

splitToLines()

private splitToLines(array<string|int, mixed> $tokens) : array<string|int, mixed>
Parameters
$tokens : array<string|int, mixed>
Return values
array<string|int, mixed>

tokenize()

private tokenize(string $source) : array<string|int, mixed>
Parameters
$source : string
Return values
array<string|int, mixed>

Search results