Factory

A factory used to retrieve a template engine given a simplified name.

With this factory it is possible to abstract away the actual class names and provide a faux name that is suitable for configuration purposes. An additional benefit is that any plugin is able to register their own template engines if desired.

package

Default

Methods

Registers the default and provided Template engines.

__construct(array<mixed,\phpDocumentor\Plugin\Scrybe\Template\TemplateInterface> $engines = array()) 

Arguments

$engines

array<mixed,\phpDocumentor\Plugin\Scrybe\Template\TemplateInterface>

Associative array of the engine class names and their name as key.

Returns a new instance of the template engine belonging to the given name.

get(string $name) : \phpDocumentor\Plugin\Scrybe\Template\TemplateInterface
Throws
\InvalidArgumentException

if the given name is not registered

Arguments

$name

string

Response

\phpDocumentor\Plugin\Scrybe\Template\TemplateInterface

Associates a human-readable / simplified name with a class name representing a template engine.

register(string $name, \phpDocumentor\Plugin\Scrybe\Template\TemplateInterface $templateEngine) : void

The class belonging to the given class name should implement the TemplateInterface. If it does not then this method won't complain (as no instantiation is done here for performance reasons) but the get() method will throw an exception.

see \phpDocumentor\Plugin\Scrybe\Template\Factory::get()

to retrieve an instance for the given $name.

Arguments

$name

string

Properties

Associative array with engine names as key and class names as value.

engines : array<mixed,string>
var

Associative array with engine names as key and class names as value.

Type(s)

array<mixed,string>