class PhpEngine implements EngineInterface, ArrayAccess
PhpEngine is an engine able to render PHP templates.
Methods
__construct(TemplateNameParserInterface $parser, LoaderInterface $loader, array $helpers = array()) Constructor. | ||
string | render(string|TemplateReferenceInterface $name, array $parameters = array()) Renders a template. | |
bool | exists(string|TemplateReferenceInterface $name) Returns true if the template exists. | |
bool | supports(string|TemplateReferenceInterface $name) Returns true if this class is able to render the given template. | |
HelperInterface | offsetGet(string $name) Gets a helper value. | |
bool | offsetExists(string $name) Returns true if the helper is defined. | |
offsetSet(HelperInterface $name, string $value) Sets a helper. | ||
offsetUnset(string $name) Removes a helper. | ||
addHelpers(array $helpers) Adds some helpers. | ||
setHelpers(array $helpers) Sets the helpers. | ||
set(HelperInterface $helper, string $alias = null) Sets a helper. | ||
bool | has(string $name) Returns true if the helper if defined. | |
HelperInterface | get(string $name) Gets a helper value. | |
extend(string $template) Decorates the current template with another one. | ||
string | escape(mixed $value, string $context = 'html') Escapes a string by using the current charset. | |
setCharset(string $charset) Sets the charset to use. | ||
string | getCharset() Gets the current charset. | |
setEscaper(string $context, callable $escaper) Adds an escaper for the given context. | ||
callable | getEscaper(string $context) Gets an escaper for a given context. | |
addGlobal(string $name, mixed $value) | ||
array | getGlobals() Returns the assigned globals. | |
LoaderInterface | getLoader() Gets the loader associated with this engine. |
Details
__construct(TemplateNameParserInterface $parser, LoaderInterface $loader, array $helpers = array())
Constructor.
string render(string|TemplateReferenceInterface $name, array $parameters = array())
Renders a template.
bool exists(string|TemplateReferenceInterface $name)
Returns true if the template exists.
bool supports(string|TemplateReferenceInterface $name)
Returns true if this class is able to render the given template.
HelperInterface offsetGet(string $name)
Gets a helper value.
bool offsetExists(string $name)
Returns true if the helper is defined.
offsetSet(HelperInterface $name, string $value)
Sets a helper.
offsetUnset(string $name)
Removes a helper.
addHelpers(array $helpers)
Adds some helpers.
setHelpers(array $helpers)
Sets the helpers.
set(HelperInterface $helper, string $alias = null)
Sets a helper.
bool has(string $name)
Returns true if the helper if defined.
HelperInterface get(string $name)
Gets a helper value.
extend(string $template)
Decorates the current template with another one.
string escape(mixed $value, string $context = 'html')
Escapes a string by using the current charset.
setCharset(string $charset)
Sets the charset to use.
string getCharset()
Gets the current charset.
setEscaper(string $context, callable $escaper)
Adds an escaper for the given context.
callable getEscaper(string $context)
Gets an escaper for a given context.
addGlobal(string $name, mixed $value)
array getGlobals()
Returns the assigned globals.
LoaderInterface getLoader()
Gets the loader associated with this engine.
Please login to continue.