/** * Constructor * * @param array $data * @author Jonathan Geiger */ public function __construct($file = NULL, $data = NULL, $env = 'default') { parent::__construct($file, $data); // Allow passing a Twig_Environment if (is_string($env)) { $env = Kohana_Twig_Environment::instance($env); } $this->_environment = $env; }
/** * Constructor * * @param null $file * @param array $data * @param string $env * * @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->load('twig.' . $env . '.loader.extension'); $env = Kohana_Twig_Environment::instance($env); } $this->_environment = $env; }