public function __construct(Request $request) { $this->container = App::get(); if (!empty($this->container['router'])) { $this->router = $this->container['router']; } $this->request = $request; }
public function __construct() { $this->container = App::get(); if (isset($this->container['view'])) { $this->view = $this->container['view']; } $this->setConnect(); $this->run(); }
function view($path, array $data = []) { return App::get()['view']->render($path, $data); }
|-------------------------------------------------------------------------- | | configuration template engine | */ $container['viewPath'] = VIEW_PATH; $container['cachePath'] = CACHE_PATH; $container['engine'] = function ($c) { return new Engine(); }; $container['view'] = $container->asShared(function ($c) { return new View($c['viewPath'], $c['cachePath'], $c['engine']); }); /* |-------------------------------------------------------------------------- | App |-------------------------------------------------------------------------- | | Container | */ App::set($container); /* |-------------------------------------------------------------------------- | Dispatcher |-------------------------------------------------------------------------- | | Simple framework dispatch | */ $dispatcher = new Dispatcher(new Request());