Пример #1
0
 public function compile($template, $data = [])
 {
     $template = $this->templatesDirectory . $template;
     if (!is_file($template)) {
         throw new FileNotFoundException($template);
     }
     return Twig::render($template, $data);
 }
 /**
  * Compiles an incident template into an incident message.
  *
  * @param string $templateSlug
  * @param array  $vars
  *
  * @return string
  */
 protected function parseIncidentTemplate($templateSlug, $vars)
 {
     Twig::setLoader(new Twig_Loader_String());
     $template = IncidentTemplate::forSlug($templateSlug)->first();
     return Twig::render($template->template, $vars);
 }