public function run($options = [])
    {
        $method = @$options['method'] ?: $_SERVER['REQUEST_METHOD'];

        $uri = @$options['uri'] ?: rawurldecode($_SERVER['REQUEST_URI']);
        if (false !== $pos = strpos($uri, '?')) {
            $uri = substr($uri, 0, $pos);
        }

        $routeInfo = $this->route($method, $uri);
        if (!$routeInfo) {
            $routeInfo = ['default', []];
        }

        list($routeName, $params) = $routeInfo;

        try {
            return $this->runAs($routeName, $params);
        } catch (\Exception $e) {
            $params[] = $e;
            return $this->runAs('defaultError', $params);
        }
    }
public function run($options = [])
    {
        $method = @$options['method'] ?: $_SERVER['REQUEST_METHOD'];

        $uri = @$options['uri'] ?: rawurldecode($_SERVER['REQUEST_URI']);
        if (false !== $pos = strpos($uri, '?')) {
            $uri = substr($uri, 0, $pos);
        }

        $routeInfo = $this->route($method, $uri);
        if (!$routeInfo) {
            $routeInfo = ['default', []];
        }

        list($routeName, $params) = $routeInfo;

        try {
            return $this->runAs($routeName, $params);
        } catch (\Exception $e) {
            $params[] = $e;
            return $this->runAs('defaultError', $params);
        }
    }
public function run ( $ options = [ ] ) { $ method = @ $ options [ 'method' ] ? : $ _SERVER [ 'REQUEST_METHOD' ] ; $ uri = @ $ options [ 'uri' ] ? : rawurldecode ( $ _SERVER [ 'REQUEST_URI' ] ) ; if ( false !== $ pos = strpos ( $ uri , '?' ) ) { $ uri = substr ( $ uri , 0 , $ pos ) ; } $ routeInfo = $ this -> route ( $ method , $ uri ) ; if ( ! $ routeInfo ) { $ routeInfo = [ 'default' , [ ] ] ; } list ( $ routeName , $ params ) = $ routeInfo ; try { return $ this -> runAs ( $ routeName , $ params ) ; } catch ( \ Exception $ e ) { $ params [ ] = $ e ; return $ this -> runAs ( 'defaultError' , $ params ) ; } }
Entry point for application
Entry point for application