public function __construct() { if (!class_exists('Sighhat\\Config')) { throw new \InvalidArgumentException('Cannot locate Config class'); } if (!class_exists('Sighhat\\Controller\\Request')) { throw new \InvalidArgumentException('Cannot locate Request class'); } if (!class_exists('Sighhat\\Controller\\Response')) { throw new \InvalidArgumentException('Cannot locate Response class'); } if (!class_exists('Sighhat\\View\\Base')) { throw new \InvalidArgumentException('Cannot locate View class'); } $this->request = $this->asShared(function ($this) { return Request::Instance(); }); $this->response = $this->asShared(function ($this) { return Response::Instance(); }); $this->config = $this->asShared(function ($this) { return Config::Instance(); }); $this->view = $this->asShared(function ($this) { return new View(new DIView()); }); $this->cache = $this->asShared(function ($this) { return Cache::Instance(); }); $this->router = $this->asShared(function ($this) { return Router::Instance(); }); }
public function __construct() { if (!class_exists('Sighhat\\Controller\\Request')) { throw new \InvalidArgumentException('Cannot locate Request class'); } $this->request = \Sighhat\Controller\Request::Instance(); $this->router = \Sighhat\Controller\Router::Instance(new DIRouter()); }
public function render404() { $this->rendered = true; \Sighhat\Controller\Router::Instance()->setController('error')->setAction('_404'); \Sighhat\Controller\Front::Instance()->Dispatch(); }