winter/modules/system/twig/Engine.php

33 lines
716 B
PHP
Raw Normal View History

2014-05-14 23:24:20 +10:00
<?php namespace System\Twig;
use Twig\Environment as TwigEnvironment;
use Illuminate\Contracts\View\Engine as EngineInterface;
2014-05-14 23:24:20 +10:00
/**
* View engine used by the system, used for converting .htm files to twig.
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
class Engine implements EngineInterface
{
/**
* @var TwigEnvironment
2014-05-14 23:24:20 +10:00
*/
protected $environment;
/**
* Constructor
*/
public function __construct(TwigEnvironment $environment)
2014-05-14 23:24:20 +10:00
{
$this->environment = $environment;
}
public function get($path, array $vars = [])
{
$template = $this->environment->loadTemplate($path);
return $template->render($vars);
}
2014-10-18 11:58:50 +02:00
}