Documentation

CodeExtension extends AbstractExtension
in package

FinalYes

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

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Properties

$charset  : string
$fileLinkFormat  : string|FileLinkFormatter|array<string|int, mixed>|false
$projectDir  : string

Methods

__construct()  : mixed
abbrClass()  : string
abbrMethod()  : string
fileExcerpt()  : string|null
Returns an excerpt of a code file around the given line number.
formatArgs()  : string
Formats an array as a string.
formatArgsAsText()  : string
Formats an array as a string.
formatFile()  : string
Formats a file path.
formatFileFromText()  : string
getFileLink()  : string|false
getFileRelative()  : string|null
getFilters()  : array<string|int, TwigFilter>
Returns a list of filters to add to the existing list.
getFunctions()  : array<string|int, TwigFunction>
Returns a list of functions to add to the existing list.
getNodeVisitors()  : array<string|int, NodeVisitorInterface>
Returns the node visitor instances to add to the existing list.
getOperators()  : array<string|int, array<string|int, mixed>>
Returns a list of operators to add to the existing list.
getTests()  : array<string|int, TwigTest>
Returns a list of tests to add to the existing list.
getTokenParsers()  : array<string|int, TokenParserInterface>
Returns the token parser instances to add to the existing list.
fixCodeMarkup()  : string

Properties

Methods

abbrClass()

public abbrClass(string $class) : string
Parameters
$class : string
Return values
string

abbrMethod()

public abbrMethod(string $method) : string
Parameters
$method : string
Return values
string

fileExcerpt()

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

public fileExcerpt(string $file, int $line[, int $srcContext = 3 ]) : string|null
Parameters
$file : string
$line : int
$srcContext : int = 3
Return values
string|null

formatArgs()

Formats an array as a string.

public formatArgs(array<string|int, mixed> $args) : string
Parameters
$args : array<string|int, mixed>
Return values
string

formatArgsAsText()

Formats an array as a string.

public formatArgsAsText(array<string|int, mixed> $args) : string
Parameters
$args : array<string|int, mixed>
Return values
string

formatFile()

Formats a file path.

public formatFile(string $file, int $line[, string $text = null ]) : string
Parameters
$file : string
$line : int
$text : string = null
Return values
string

formatFileFromText()

public formatFileFromText(string $text) : string
Parameters
$text : string
Return values
string
public getFileLink(string $file, int $line) : string|false
Parameters
$file : string
$line : int
Return values
string|false

getFileRelative()

public getFileRelative(string $file) : string|null
Parameters
$file : string
Return values
string|null

getFilters()

Returns a list of filters to add to the existing list.

public getFilters() : array<string|int, TwigFilter>
Return values
array<string|int, TwigFilter>

getOperators()

Returns a list of operators to add to the existing list.

public getOperators() : array<string|int, array<string|int, mixed>>
Return values
array<string|int, array<string|int, mixed>>

First array of unary operators, second array of binary operators

fixCodeMarkup()

protected static fixCodeMarkup(string $line) : string
Parameters
$line : string
Return values
string

        
On this page

Search results