public static function getInstance(Wee $wee, $template, $config = []) { $hash = md5($wee->filename() . $template . json_encode([$wee->variables(), $config])); if (!isset(self::$instances[$hash])) { $class = get_called_class(); self::$instances[$hash] = new $class($wee, $template, $config); } return self::$instances[$hash]; }
public function implementTwig() { $this->wee->config('Wee.Twig.cfg.php'); $this->wee->template('{{ hello|upper }}'); $this->wee->hello = 'Hello World!'; $output = $this->wee->template(); $this->equ($output, 'HELLO WORLD!', 'Twig template result and original not same!'); }