public function getResponse(\Kernel\Router\Router $route_obj) { try { $result = $route_obj->runAction(); return $this->getOkResponse($result); } catch (\Exception $e) { return $this->getFailResponse(); } }
/** * Injects particular page content into the main layout and sends it as response * * @param string $content */ private static function _sendResponse($content) { $renderer = new Renderer(APP_PATH . '/layout.html.php'); $renderer->assign(array('content' => $content, 'user' => Token::getUser(), 'route' => Router::getInstance()->getRoute())); $response = $renderer->render(); Connection::getInstance()->disconnect(); echo $response; Token::set('flush', null); exit; }
<?php /** * Bootstrap File for including necessary config files and autoloader. * Also will be used as phpunit bootsrap * * @author Mikhail Lantukh <*****@*****.**> */ define('APP_PATH', __DIR__); include_once __DIR__ . '/../src/Loader.php'; \Kernel\Router\Router::getInstance()->load(include 'routes.php'); Application::loadConfig(include 'config.php');