|
| compile ($code) |
| Compile the Mustache code into PHP code using LightnCandy. More...
|
|
| compileForEval ($fileContents, $filename) |
| Wrapper for compile() function that verifies successful compilation and strips out the '<?php' part so that the code is ready for eval() More...
|
|
| getTemplate ($templateName) |
| Returns a given template function if found, otherwise throws an exception. More...
|
|
| getTemplateFilename ($templateName) |
| Constructs the location of the the source Mustache template. More...
|
|
Definition at line 23 of file TemplateParser.php.
TemplateParser::__construct |
( |
|
$templateDir = null , |
|
|
|
$forceRecompile = false |
|
) |
| |
TemplateParser::compile |
( |
|
$code | ) |
|
|
protected |
Compile the Mustache code into PHP code using LightnCandy.
- Parameters
-
- Returns
- string PHP code (with '<?php')
- Exceptions
-
Definition at line 167 of file TemplateParser.php.
References $code.
Referenced by compileForEval().
TemplateParser::compileForEval |
( |
|
$fileContents, |
|
|
|
$filename |
|
) |
| |
|
protected |
Wrapper for compile() function that verifies successful compilation and strips out the '<?php' part so that the code is ready for eval()
- Parameters
-
string | $fileContents | Mustache code |
string | $filename | Name of the template |
- Returns
- string PHP code (without '<?php')
- Exceptions
-
Definition at line 145 of file TemplateParser.php.
References $code, and compile().
Referenced by getTemplate().
TemplateParser::getTemplate |
( |
|
$templateName | ) |
|
|
protected |
TemplateParser::getTemplateFilename |
( |
|
$templateName | ) |
|
|
protected |
Constructs the location of the the source Mustache template.
- Parameters
-
string | $templateName | The name of the template |
- Returns
- string
- Exceptions
-
UnexpectedValueException | If $templateName attempts upwards directory traversal |
Definition at line 54 of file TemplateParser.php.
Referenced by getTemplate().
TemplateParser::processTemplate |
( |
|
$templateName, |
|
|
|
$args, |
|
|
array |
$scopes = [] |
|
) |
| |
Returns HTML for a given template by calling the template function with the given args.
'ExampleTemplate',
[
'username' =>
$user->getName(),
'message' => 'Hello!'
]
);
- Parameters
-
string | $templateName | The name of the template |
mixed | $args | |
array | $scopes | |
- Returns
- string
Definition at line 200 of file TemplateParser.php.
References $args, $template, and getTemplate().
bool TemplateParser::$forceRecompile = false |
|
protected |
callable [] TemplateParser::$renderers |
|
protected |
string TemplateParser::$templateDir |
|
protected |
The documentation for this class was generated from the following file: