|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
* This file is part of the Symfony package. |
|
|
5 |
* |
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com> |
|
|
7 |
* |
|
|
8 |
* For the full copyright and license information, please view the LICENSE |
|
|
9 |
* file that was distributed with this source code. |
|
|
10 |
*/ |
|
|
11 |
|
|
|
12 |
namespace Symfony\Component\Templating; |
|
|
13 |
|
|
|
14 |
/** |
|
|
15 |
* EngineInterface is the interface each engine must implement. |
|
|
16 |
* |
|
|
17 |
* All methods relies on a template name. A template name is a |
|
|
18 |
* "logical" name for the template, and as such it does not refer to |
|
|
19 |
* a path on the filesystem (in fact, the template can be stored |
|
|
20 |
* anywhere, like in a database). |
|
|
21 |
* |
|
|
22 |
* The methods should accept any name. If the name is not an instance of |
|
|
23 |
* TemplateReferenceInterface, a TemplateNameParserInterface should be used to |
|
|
24 |
* convert the name to a TemplateReferenceInterface instance. |
|
|
25 |
* |
|
|
26 |
* Each template loader use the logical template name to look for |
|
|
27 |
* the template. |
|
|
28 |
* |
|
|
29 |
* @author Fabien Potencier <fabien@symfony.com> |
|
|
30 |
* |
|
|
31 |
* @api |
|
|
32 |
*/ |
|
|
33 |
interface EngineInterface |
|
|
34 |
{ |
|
|
35 |
/** |
|
|
36 |
* Renders a template. |
|
|
37 |
* |
|
|
38 |
* @param mixed $name A template name or a TemplateReferenceInterface instance |
|
|
39 |
* @param array $parameters An array of parameters to pass to the template |
|
|
40 |
* |
|
|
41 |
* @return string The evaluated template as a string |
|
|
42 |
* |
|
|
43 |
* @throws \RuntimeException if the template cannot be rendered |
|
|
44 |
* |
|
|
45 |
* @api |
|
|
46 |
*/ |
|
|
47 |
function render($name, array $parameters = array()); |
|
|
48 |
|
|
|
49 |
/** |
|
|
50 |
* Returns true if the template exists. |
|
|
51 |
* |
|
|
52 |
* @param mixed $name A template name or a TemplateReferenceInterface instance |
|
|
53 |
* |
|
|
54 |
* @return Boolean true if the template exists, false otherwise |
|
|
55 |
* |
|
|
56 |
* @api |
|
|
57 |
*/ |
|
|
58 |
function exists($name); |
|
|
59 |
|
|
|
60 |
/** |
|
|
61 |
* Returns true if this class is able to render the given template. |
|
|
62 |
* |
|
|
63 |
* @param mixed $name A template name or a TemplateReferenceInterface instance |
|
|
64 |
* |
|
|
65 |
* @return Boolean true if this class supports the given template, false otherwise |
|
|
66 |
* |
|
|
67 |
* @api |
|
|
68 |
*/ |
|
|
69 |
function supports($name); |
|
|
70 |
} |