/** * Constructor * * @param string $name * @param string $handler */ public function __construct($name, $handler = NULL) { if (!self::$handler) { $cogear = getInstance(); self::$handler = $cogear->get('template.handler', self::FILE); } $this->name = $name; event('template.' . $name, $this); $handler or $handler = self::$handler; switch ($handler) { case self::DB: $this->adapter = new Template_Db($this->name); break; case self::FILE: default: $this->adapter = new Template_File($this->name); } }