1 | <?php |
||
16 | class TemplateParser |
||
17 | { |
||
18 | /** |
||
19 | * @var Configuration |
||
20 | */ |
||
21 | protected $configuration; |
||
22 | |||
23 | /** |
||
24 | * @var RenderingContextInterface |
||
25 | */ |
||
26 | protected $renderingContext; |
||
27 | |||
28 | /** |
||
29 | * @var ComponentInterface[] |
||
30 | */ |
||
31 | protected $stack = []; |
||
32 | |||
33 | /** |
||
34 | * @var Source[] |
||
35 | */ |
||
36 | protected $sources = []; |
||
37 | |||
38 | public function __construct(RenderingContextInterface $renderingContext) |
||
43 | |||
44 | public function getComponentBeingParsed(): ?ComponentInterface |
||
48 | |||
49 | public function parseFile(string $templatePathAndFilename, ?Configuration $configuration = null): ComponentInterface |
||
62 | |||
63 | /** |
||
64 | * Parses a given template string and returns a parsed template object. |
||
65 | * |
||
66 | * The resulting ParsedTemplate can then be rendered by calling evaluate() on it. |
||
67 | * |
||
68 | * Normally, you should use a subclass of AbstractTemplateView instead of calling the |
||
69 | * TemplateParser directly. |
||
70 | * |
||
71 | * @param Source $source Template source instance |
||
72 | * @param Configuration|null Template parsing configuration to use |
||
73 | * @return ComponentInterface Parsed template |
||
74 | * @throws Exception |
||
75 | */ |
||
76 | public function parse(Source $source, ?Configuration $configuration = null): ComponentInterface |
||
97 | |||
98 | /** |
||
99 | * @param string $templateIdentifier |
||
100 | * @param \Closure $templateSourceClosure Closure which returns the template source if needed |
||
101 | * @return ComponentInterface |
||
102 | */ |
||
103 | public function getOrParseAndStoreTemplate(string $templateIdentifier, \Closure $templateSourceClosure): ComponentInterface |
||
114 | |||
115 | /** |
||
116 | * @param string $templateIdentifier |
||
117 | * @param \Closure $templateSourceClosure |
||
118 | * @return ComponentInterface |
||
119 | */ |
||
120 | protected function parseTemplateSource(string $templateIdentifier, \Closure $templateSourceClosure): ComponentInterface |
||
129 | } |
||
130 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.