コード例 #1
0
ファイル: Front.php プロジェクト: Taluu/Tamed-Framework
 /**
  * Starts and render the frame
  *
  * @param \Http\Request $_request HTTP Request handler
  * @param \Http\Response $_response HTTP Response handler
  * @param \View\Bridge $_view View engine
  */
 protected final function __construct(Request $_request, Response $_response, Bridge $_view)
 {
     Obj::$controller = $this;
     $this->_view = $_view;
     $this->_request = $_request;
     $this->_response = $_response;
     $this->_route = Obj::$router->route($_request);
     $this->_appDir = sprintf('%1$s/../../apps/%2$s', __DIR__, mb_strtolower($this->_route->app));
     $this->_config = is_dir($this->_appDir . '/conf') ? new Loader($this->_appDir . '/conf', Obj::$config->getEnv(), Obj::$config) : Obj::$config;
 }
コード例 #2
0
ファイル: __bootstrap.php プロジェクト: Taluu/Tamed-Framework
            break;
        case E_USER_DEPRECATED:
        case E_USER_NOTICE:
        case E_DEPRECATED:
        case E_NOTICE:
        case E_STRICT:
        default:
            $err = Debug::LEVEL_INFO;
            break;
    }
    $e = new \ErrorException($errstr, 0, $errno, $errfile, $errline);
    Debug::log('An error occurred (' . $e->__toString() . ')', $err);
    throw $e;
});
Obj::$config = new Configuration_Loader(__DIR__ . '/../conf/');
Obj::$router = new Router();
$routes = Obj::$config->get('routes', function (&$v, $k) {
    // -- if a 'app' part is not set, it has to be constructed
    if (!isset($v['app'])) {
        if (!isset($v['controller'], $v['action'])) {
            throw new \Exception('The route does not have the required arguments');
        }
        $v['app'] = $v['controller'] . ':' . $v['action'];
    }
    $v = new Route($v['app'], $v['pattern']);
});
foreach ($routes as $name => &$route) {
    Debug::info('Adding route %s', (string) $name);
    Obj::$router->addRoute($name, $route);
}
/*