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 | public function __construct(RenderingContextInterface $renderingContext) |
||
33 | |||
34 | public function parseFile(string $templatePathAndFilename, ?Configuration $configuration = null): ComponentInterface |
||
43 | |||
44 | /** |
||
45 | * Parses a given template string and returns a parsed template object. |
||
46 | * |
||
47 | * The resulting ParsedTemplate can then be rendered by calling evaluate() on it. |
||
48 | * |
||
49 | * Normally, you should use a subclass of AbstractTemplateView instead of calling the |
||
50 | * TemplateParser directly. |
||
51 | * |
||
52 | * @param string $templateString The template to parse as a string |
||
53 | * @param Configuration|null Template parsing configuration to use |
||
54 | * @return ComponentInterface Parsed template |
||
55 | * @throws Exception |
||
56 | */ |
||
57 | public function parse(string $templateString, ?Configuration $configuration = null): ComponentInterface |
||
70 | |||
71 | /** |
||
72 | * @param string $templateIdentifier |
||
73 | * @param \Closure $templateSourceClosure Closure which returns the template source if needed |
||
74 | * @return ComponentInterface |
||
75 | */ |
||
76 | public function getOrParseAndStoreTemplate(string $templateIdentifier, \Closure $templateSourceClosure): ComponentInterface |
||
87 | |||
88 | /** |
||
89 | * @param string $templateIdentifier |
||
90 | * @param \Closure $templateSourceClosure |
||
91 | * @return ComponentInterface |
||
92 | */ |
||
93 | protected function parseTemplateSource(string $templateIdentifier, \Closure $templateSourceClosure): ComponentInterface |
||
102 | |||
103 | /** |
||
104 | * Returns a unique identifier for the given file in the format |
||
105 | * <PackageKey>_<SubPackageKey>_<ControllerName>_<prefix>_<SHA1> |
||
106 | * The SH1 hash is a checksum that is based on the file path and last modification date |
||
107 | * |
||
108 | * @param string $pathAndFilename |
||
109 | * @param string $prefix |
||
110 | * @return string |
||
111 | */ |
||
112 | protected function createIdentifierForFile(string $pathAndFilename, string $prefix): string |
||
116 | } |
||
117 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.