/** * Executes a compiler plugin. * * Throws an exception in case an error occurred during compilation of the tag. * * @param string $pluginClassName Name of the compiler plugin class to execute * @param \Ableron\Core\Template\TemplateTag $templateTag The template tag to compile * @throws \Ableron\Core\Exception\SystemException * @return string */ private function executeCompilerPlugin($pluginClassName, TemplateTag $templateTag) { // execute closing tag if ($templateTag->isClosingTag()) { return $this->compileCompilerPluginClosingTag($templateTag->getTagName()); } // compile opening tag return $this->compileCompilerPluginOpeningTag($this->getCompilerPlugin($pluginClassName, $templateTag)); }
/** * Extracts the path of the parent template file of the given template. * * Returns NULL in case the given template does not has a parent template. * * @param string $template The template to extract the parent template path from * @return string|null */ private function extractParentTemplatePath($template) { // extract template tags from given template $templateTags = $this->templateCompiler->extractTemplateTags($template); // check whether at least one tag has been found if (isset($templateTags[0])) { // get first tag $firstTemplateTag = new TemplateTag($templateTags[0]); // return parent template path in case first tag is an extends-tag if ($firstTemplateTag->getTagName() === 'extends') { return $firstTemplateTag->getArgument(0); } } // given template does not has a parent template return null; }