class TwigFunctions extends AbstractExtension

Class TwigFunctions

Properties

private Session $session To manage PHP Sessions.
private TemplateRender $renderer Manage the renderer.
private DebugTool $debugTool The debug tool used.
private Translator $translator The translator manager.

Methods

__construct()

TwigFunctions constructor.

TwigFunction[]
getFunctions()

Return a list of functions.

array|mixed
flash(array $params)

Returns data messages from flash information.

string
copyright()

Returns the copyright content.

string
getTotalTime(bool $inMilliseconds = true)

Returns the total execution time.

string
unescape(string $value)

Unescape html entities.

string
snakeToCamel(string $toCamel)

Returns the string to camel case format.

string
trans(null|string $key)

Returns a translated string.

string
getResourceUri(string $path)

Check different possible locations for the file and return the corresponding URI, if it exists.

string
getHeader()

Returns the necessary html code in the header of the template, to display the debug bar.

string
getFooter()

Returns the necessary html code at the footer of the template, to display the debug bar.

string
renderComponent(string $templatePath, array $data)

Renders the component with shared data.

string
getUrl(string $url = '')

Returns the base url.

Details

at line 56
__construct()

TwigFunctions constructor.

at line 74
TwigFunction[] getFunctions()

Return a list of functions.

Return Value

TwigFunction[]

at line 98
array|mixed flash(array $params)

Returns data messages from flash information.

Parameters

array $params

Return Value

array|mixed

Returns the copyright content.

Return Value

string

at line 131
string getTotalTime(bool $inMilliseconds = true)

Returns the total execution time.

NOTE: DebugBar needs around 2-10ms for itself (depends on data tabs on it).

Parameters

bool $inMilliseconds if true, return the time in ms, else in seconds

Return Value

string

at line 144
string unescape(string $value)

Unescape html entities.

Parameters

string $value

Return Value

string

at line 156
string snakeToCamel(string $toCamel)

Returns the string to camel case format.

Parameters

string $toCamel

Return Value

string

at line 168
string trans(null|string $key)

Returns a translated string.

Parameters

null|string $key

Return Value

string

at line 181
string getResourceUri(string $path)

Check different possible locations for the file and return the corresponding URI, if it exists.

Parameters

string $path

Return Value

string

at line 191
string getHeader()

Returns the necessary html code in the header of the template, to display the debug bar.

Return Value

string

at line 201
string getFooter()

Returns the necessary html code at the footer of the template, to display the debug bar.

Return Value

string

at line 214
string renderComponent(string $templatePath, array $data)

Renders the component with shared data.

Parameters

string $templatePath
array $data

Return Value

string

at line 229
string getUrl(string $url = '')

Returns the base url.

Parameters

string $url

Return Value

string