/** * Constructor * * @param array $data * @author Jonathan Geiger */ public function __construct($file = NULL, $data = NULL, $env = 'default') { if ($file !== NULL) { $this->set_filename($file); } // Allow passing the environment if $data is not needed if (is_string($data)) { $env = $data; $data = NULL; } if ($data !== NULL) { // Add the values to the current data $this->data = $data + $this->data; } // Allow passing a Twig_Environment if ($env instanceof Twig_Environment == FALSE) { // Load the default extension from the config $this->extension = Kohana::config('twig.' . $env . '.loader.extension'); $env = Kohana_Twig::instance($env); } $this->environment = $env; }
/** * @return Twig_Environment */ public static function twig() { return Kohana_Twig::instance()->twig; }