EscaperExtension
extends AbstractExtension
in package
Table of Contents
Properties
- $defaultStrategy : mixed
- $environment : mixed
- $escaper : mixed
- $escapers : mixed
Methods
- __construct() : mixed
- addSafeClass() : mixed
- getDefaultStrategy() : string|false
- Gets the default strategy to use when not defined by the user.
- getEscapers() : mixed
- Gets all defined escapers.
- 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.
- setDefaultStrategy() : void
- Sets the default strategy to use when not defined by the user.
- setEnvironment() : void
- setEscaper() : mixed
- Defines a new escaper to be used via the escape filter.
- setEscaperRuntime() : mixed
- setSafeClasses() : mixed
Properties
$defaultStrategy
private
mixed
$defaultStrategy
$environment
private
mixed
$environment
$escaper
private
mixed
$escaper
$escapers
private
mixed
$escapers
= []
Methods
__construct()
public
__construct([string|false|callable $defaultStrategy = 'html' ]) : mixed
Parameters
- $defaultStrategy : string|false|callable = 'html'
-
An escaping strategy
Tags
addSafeClass()
public
addSafeClass(string $class, array<string|int, mixed> $strategies) : mixed
Parameters
- $class : string
- $strategies : array<string|int, mixed>
Tags
getDefaultStrategy()
Gets the default strategy to use when not defined by the user.
public
getDefaultStrategy(string $name) : string|false
Parameters
- $name : string
-
The template name
Return values
string|false —The default strategy to use for the template
getEscapers()
Gets all defined escapers.
public
getEscapers() : mixed
Tags
getFilters()
Returns a list of filters to add to the existing list.
public
getFilters() : array<string|int, TwigFilter>
Return values
array<string|int, TwigFilter>getFunctions()
Returns a list of functions to add to the existing list.
public
getFunctions() : array<string|int, TwigFunction>
Return values
array<string|int, TwigFunction>getNodeVisitors()
Returns the node visitor instances to add to the existing list.
public
getNodeVisitors() : array<string|int, NodeVisitorInterface>
Return values
array<string|int, NodeVisitorInterface>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
getTests()
Returns a list of tests to add to the existing list.
public
getTests() : array<string|int, TwigTest>
Return values
array<string|int, TwigTest>getTokenParsers()
Returns the token parser instances to add to the existing list.
public
getTokenParsers() : array<string|int, TokenParserInterface>
Return values
array<string|int, TokenParserInterface>setDefaultStrategy()
Sets the default strategy to use when not defined by the user.
public
setDefaultStrategy(string|false|callable(string $templateName): string $defaultStrategy) : void
The strategy can be a valid PHP callback that takes the template name as an argument and returns the strategy to use.
Parameters
- $defaultStrategy : string|false|callable(string $templateName): string
-
An escaping strategy
setEnvironment()
public
setEnvironment(Environment $environment[, bool $triggerDeprecation = true ]) : void
Parameters
- $environment : Environment
- $triggerDeprecation : bool = true
Tags
setEscaper()
Defines a new escaper to be used via the escape filter.
public
setEscaper(string $strategy, callable $callable) : mixed
Parameters
- $strategy : string
-
The strategy name that should be used as a strategy in the escape call
- $callable : callable
-
A valid PHP callable
Tags
setEscaperRuntime()
public
setEscaperRuntime(EscaperRuntime $escaper) : mixed
Parameters
- $escaper : EscaperRuntime
Tags
setSafeClasses()
public
setSafeClasses([array<string|int, mixed> $safeClasses = [] ]) : mixed
Parameters
- $safeClasses : array<string|int, mixed> = []