1 | <?php |
||
11 | class SimpleZendViewRenderer implements TemplateRendererInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var RendererInterface |
||
15 | */ |
||
16 | private $renderer; |
||
17 | |||
18 | public function __construct(RendererInterface $renderer) |
||
22 | |||
23 | /** |
||
24 | * Render a template, optionally with parameters. |
||
25 | * |
||
26 | * Implementations MUST support the `namespace::template` naming convention, |
||
27 | * and allow omitting the filename extension. |
||
28 | * |
||
29 | * @param string $name |
||
30 | * @param array|\Traversable $params |
||
31 | * @return string |
||
32 | */ |
||
33 | public function render($name, $params = []): string |
||
52 | |||
53 | /** |
||
54 | * Add a template path to the engine. |
||
55 | * |
||
56 | * Adds a template path, with optional namespace the templates in that path |
||
57 | * provide. |
||
58 | * |
||
59 | * @param string $path |
||
60 | * @param string $namespace |
||
61 | */ |
||
62 | public function addPath($path, $namespace = null) |
||
66 | |||
67 | /** |
||
68 | * Retrieve configured paths from the engine. |
||
69 | * |
||
70 | * @return TemplatePath[] |
||
71 | */ |
||
72 | public function getPaths(): array |
||
76 | |||
77 | /** |
||
78 | * Add a default parameter to use with a template. |
||
79 | * |
||
80 | * Use this method to provide a default parameter to use when a template is |
||
81 | * rendered. The parameter may be overridden by providing it when calling |
||
82 | * `render()`, or by calling this method again with a null value. |
||
83 | * |
||
84 | * The parameter will be specific to the template name provided. To make |
||
85 | * the parameter available to any template, pass the TEMPLATE_ALL constant |
||
86 | * for the template name. |
||
87 | * |
||
88 | * If the default parameter existed previously, subsequent invocations with |
||
89 | * the same template name and parameter name will overwrite. |
||
90 | * |
||
91 | * @param string $templateName Name of template to which the param applies; |
||
92 | * use TEMPLATE_ALL to apply to all templates. |
||
93 | * @param string $param Param name. |
||
94 | * @param mixed $value |
||
95 | */ |
||
96 | public function addDefaultParam($templateName, $param, $value) |
||
100 | } |
||
101 |