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