/** * Draw a template using application defined * template engine. * * @throws \Exception * * @return string */ public function draw() { $file = Application::current()->getDirectory(); $file .= "views/{$this->templateName}."; $file .= self::$extension; if (!file_exists($file)) { throw new Exception("Template file not found: {$file}"); } return $this->templateEngine->draw($file, $this->data); }
/** * Get current application container. * * @return \Corviz\DI\Container */ protected final function container() { return $this->application->getContainer(); }
/** * Get an class/service from the container;. * * @param string $className * * @return mixed */ protected function container(string $className) { return Application::current()->getContainer()->get($className); }