|
ILIAS
trunk Revision v12.0_alpha-1221-g4e438232683
|
Mustache implementation of the template engine interface. More...
Inheritance diagram for ILIAS\Mail\TemplateEngine\Mustache\MustacheTemplateEngine:
Collaboration diagram for ILIAS\Mail\TemplateEngine\Mustache\MustacheTemplateEngine:Public Member Functions | |
| __construct (private readonly \Mustache\Engine $engine) | |
| render (string $template, array|object $context) | |
| Renders a template string with the given context. More... | |
| render (string $template, array|object $context) | |
| Renders a template string with the given context. More... | |
Mustache implementation of the template engine interface.
Wraps \Mustache\Engine to decouple Mail component from the concrete library.
Definition at line 29 of file MustacheTemplateEngine.php.
| ILIAS\Mail\TemplateEngine\Mustache\MustacheTemplateEngine::__construct | ( | private readonly \Mustache\Engine | $engine | ) |
Definition at line 31 of file MustacheTemplateEngine.php.
| ILIAS\Mail\TemplateEngine\Mustache\MustacheTemplateEngine::render | ( | string | $template, |
| array|object | $context | ||
| ) |
Renders a template string with the given context.
| string | $template | The template string. |
| array<string,mixed>|object | $context Data for the template. Either an associative array of key-value pairs, or an object whose public properties and methods the engine uses to resolve values. Exact behavior depends on the engine implementation. |
Example context object with properties, a method, and a list for repeated blocks: $context = new class () { public string $recipient = 'Jane'; public int $amount = 100; public array $lines = [ ['title' => 'Item A', 'qty' => 2], ['title' => 'Item B', 'qty' => 1], ]; public function net_amount(): float { return $this->amount * 0.9; } };
Implements ILIAS\Mail\TemplateEngine\TemplateEngineInterface.
Definition at line 36 of file MustacheTemplateEngine.php.