EscaperRuntime
in package
implements
RuntimeExtensionInterface
FinalYes
Table of Contents
Interfaces
Properties
Methods
- __construct() : mixed
- addSafeClass() : mixed
- escape() : mixed
- Escapes a string.
- getEscapers() : mixed
- Gets all defined escapers.
- setEscaper() : mixed
- Defines a new escaper to be used via the escape filter.
- setSafeClasses() : mixed
- convertEncoding() : mixed
Properties
$charset
private
mixed
$charset
$escapers
private
mixed
$escapers
= []
Methods
__construct()
public
__construct([mixed $charset = 'UTF-8' ]) : mixed
Parameters
- $charset : mixed = 'UTF-8'
addSafeClass()
public
addSafeClass(string $class, array<string|int, mixed> $strategies) : mixed
Parameters
- $class : string
- $strategies : array<string|int, mixed>
escape()
Escapes a string.
public
escape(mixed $string[, string $strategy = 'html' ][, string|null $charset = null ][, bool $autoescape = false ]) : mixed
Parameters
- $string : mixed
-
The value to be escaped
- $strategy : string = 'html'
-
The escaping strategy
- $charset : string|null = null
-
The charset
- $autoescape : bool = false
-
Whether the function is called by the auto-escaping feature (true) or by the developer (false)
Tags
getEscapers()
Gets all defined escapers.
public
getEscapers() : mixed
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
setSafeClasses()
public
setSafeClasses([array<string|int, mixed> $safeClasses = [] ]) : mixed
Parameters
- $safeClasses : array<string|int, mixed> = []
convertEncoding()
private
convertEncoding(string $string, string $to, string $from) : mixed
Parameters
- $string : string
- $to : string
- $from : string