/** * Loads the template. * * @param string $template The template relative path * @param array $vars The template variables * * @throws TemplateNotFoundException When template does not exist * @throws UnsupportedTemplateException When template format is not supported * * @return TemplateInterface */ public function loadTemplate($template, array $vars = []) { if (!$this->supports($template)) { throw new UnsupportedTemplateException(sprintf('Template %s is not supported by this engine.', $template)); } if (!$this->exists($template)) { throw new TemplateNotFoundException(sprintf('Template %s does not exist.', $template)); } return new Template($this->plates->path($template), array_merge($this->plates->getData(), $vars)); }