\Charcoal\ViewAbstractEngine

Default implementation, as abstract class, of the `EngineInterface`.

View Engines are comprised of 2 things:

  • A template loader, wich is a LoaderInterfaceObject
    • Set with set_loader() / Get with loader()
    • Provides loadtemplate() method
  • A render() method, which takes a $template and a $context arguments

Engines implements the LoggerAwareInterface. A logger can be accessed with the logger() method.

Summary

Methods
Properties
Constants
type()
__construct()
loadTemplate()
render()
renderTemplate()
No public properties found
No constants found
loader()
No protected properties found
N/A
setLoader()
$loader
N/A

Properties

Methods

type()

type() : string

Returns

string

__construct()

__construct(array  $data) 

Build the object with an array of dependencies.

Required parameters:

  • logger a PSR-3 logger

Optional parameters:

  • loader a Loader object

Parameters

array $data

Engine dependencie.

loadTemplate()

loadTemplate(string  $templateIdent) : string

Delegates template loading to the engine's Loader object.

Parameters

string $templateIdent

The template identifier to load.

Returns

string —

The template string, loaded from identifier.

render()

render(string  $templateIdent, mixed  $context) : string

Load a template (from identifier) and render it.

Parameters

string $templateIdent

The template identifier to load and render.

mixed $context

The rendering context.

Returns

string —

The rendered template string.

renderTemplate()

renderTemplate(string  $templateString, mixed  $context) : string

Render a template (from string).

Parameters

string $templateString

The template string to render.

mixed $context

The rendering context.

Returns

string —

The rendered template string.