FlexibleStringTemplate
extends EnhancedStringTemplate
in package
Table of Contents
Properties
- $_callback : callable
- General callback function.
- $_callbacks : array<string|int, mixed>
- Array of callback function for specific templates.
Methods
- __construct() : mixed
- Constructor.
- format() : string
- Format a template string with $data
- _getTemplateName() : string
- Retrieve a template name after checking the various callbacks.
Properties
$_callback
General callback function.
protected
callable
$_callback
= null
$_callbacks
Array of callback function for specific templates.
protected
array<string|int, mixed>
$_callbacks
= null
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $config = [] ][, callable $callback = null ][, arra $callbacks = [] ]) : mixed
Parameters
- $config : array<string|int, mixed> = []
-
A set of templates to add.
- $callback : callable = null
-
A general callback that will be called before retrieving any templates.
- $callbacks : arra = []
-
An array of callbacks.
format()
Format a template string with $data
public
format(string $name, array<string|int, mixed> $data) : string
Parameters
- $name : string
-
The template name.
- $data : array<string|int, mixed>
-
The data to insert.
Return values
string_getTemplateName()
Retrieve a template name after checking the various callbacks.
protected
_getTemplateName(string $name[, array<string|int, mixed> &$data = [] ]) : string
Parameters
- $name : string
-
The original name of the template.
- $data : array<string|int, mixed> = []
-
The data to update.
Return values
string —The new name of the template.