Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * Get current application container.
  *
  * @return \Corviz\DI\Container
  */
 protected final function container()
 {
     return $this->application->getContainer();
 }
Example #3
0
 /**
  * Get an class/service from the container;.
  *
  * @param string $className
  *
  * @return mixed
  */
 protected function container(string $className)
 {
     return Application::current()->getContainer()->get($className);
 }