class CodeExtension extends AbstractExtension

Twig extension relate to PHP code and used by the profiler and the default exception templates.

Methods

__construct(string|FileLinkFormatter $fileLinkFormat, string $projectDir, string $charset)

No description

getFilters()

{@inheritdoc}

abbrClass($class)

No description

abbrMethod($method)

No description

string
formatArgs(array $args)

Formats an array as a string.

string
formatArgsAsText(array $args)

Formats an array as a string.

string
fileExcerpt(string $file, int $line, int $srcContext = 3)

Returns an excerpt of a code file around the given line number.

string
formatFile(string $file, int $line, string $text = null)

Formats a file path.

string|false
getFileLink(string $file, int $line)

Returns the link for a given file/line pair.

string|null
getFileRelative(string $file)

No description

formatFileFromText($text)

No description

formatLogMessage($message, array $context)

No description

getName()

{@inheritdoc}

static 
fixCodeMarkup($line)

No description

Details

at line 34
__construct(string|FileLinkFormatter $fileLinkFormat, string $projectDir, string $charset)

Parameters

string|FileLinkFormatter $fileLinkFormat The format for links to source files
string $projectDir The project directory
string $charset The charset

at line 44
getFilters()

{@inheritdoc}

at line 60
abbrClass($class)

Parameters

$class

at line 68
abbrMethod($method)

Parameters

$method

at line 89
string formatArgs(array $args)

Formats an array as a string.

Parameters

array $args The argument array

Return Value

string

at line 122
string formatArgsAsText(array $args)

Formats an array as a string.

Parameters

array $args The argument array

Return Value

string

at line 136
string fileExcerpt(string $file, int $line, int $srcContext = 3)

Returns an excerpt of a code file around the given line number.

Parameters

string $file A file path
int $line The selected line number
int $srcContext The number of displayed lines around or -1 for the whole file

Return Value

string An HTML string

at line 174
string formatFile(string $file, int $line, string $text = null)

Formats a file path.

Parameters

string $file An absolute file path
int $line The line number
string $text Use this text for the link rather than the file path

Return Value

string

Returns the link for a given file/line pair.

Parameters

string $file An absolute file path
int $line The line number

Return Value

string|false A link or false

at line 214
string|null getFileRelative(string $file)

Parameters

string $file

Return Value

string|null

at line 225
formatFileFromText($text)

Parameters

$text

at line 235
formatLogMessage($message, array $context)

Parameters

$message
array $context

at line 256
getName()

{@inheritdoc}

at line 261
static protected fixCodeMarkup($line)

Parameters

$line