src/php/main/Eix/Core/Requests/Http.php
private function parsePath()
    {
        $components = array();
        $uri = $this->getUri();

        if ($uri !== false) {
            Logger::get()->debug('Parsing URI: ' . $uri);
            // Add the URL parameters.
            $components = $this->getHttpParameters();

            $matched = false;
            foreach (self::getRoutes() as $route) {
                if (preg_match("#^{$route['uri']}$#", $uri, $matches)) {
                    Logger::get()->debug('Found a matching route: ' . $route['uri']);
                    foreach ($route as $name => $value) {
                        switch ($name) {
                            case 'uri':
                                // Ignore.
                                break;
                            default:
                                if (is_numeric($value)) {
                                    // If the value is a number, it refers to a
                                    // regex block in the route.
                                    if (isset($matches[$value])) {
                                        $components[$name] = $matches[$value];
                                    }
                                } else {
                                    // Otherwise it's the parameter's value.
                                    $components[$name] = $value;
                                }
                                break;
                        }
                    }

                    $matched = true;
                    break;
                }
            }

            // If no matching routes have been found, the request is not
            // considered valid.
            if (!$matched) {
                throw new Exception("No routes match URI '{$uri}'.", 404);
            }
        }

        return $components;
    }
private function parsePath()
    {
        $components = array();
        $uri = $this->getUri();

        if ($uri !== false) {
            Logger::get()->debug('Parsing URI: ' . $uri);
            // Add the URL parameters.
            $components = $this->getHttpParameters();

            $matched = false;
            foreach (self::getRoutes() as $route) {
                if (preg_match("#^{$route['uri']}$#", $uri, $matches)) {
                    Logger::get()->debug('Found a matching route: ' . $route['uri']);
                    foreach ($route as $name => $value) {
                        switch ($name) {
                            case 'uri':
                                // Ignore.
                                break;
                            default:
                                if (is_numeric($value)) {
                                    // If the value is a number, it refers to a
                                    // regex block in the route.
                                    if (isset($matches[$value])) {
                                        $components[$name] = $matches[$value];
                                    }
                                } else {
                                    // Otherwise it's the parameter's value.
                                    $components[$name] = $value;
                                }
                                break;
                        }
                    }

                    $matched = true;
                    break;
                }
            }

            // If no matching routes have been found, the request is not
            // considered valid.
            if (!$matched) {
                throw new Exception("No routes match URI '{$uri}'.", 404);
            }
        }

        return $components;
    }
private function parsePath ( ) { $ components = array ( ) ; $ uri = $ this -> getUri ( ) ; if ( $ uri !== false ) { Logger :: get ( ) -> debug ( 'Parsing URI: ' . $ uri ) ; // Add the URL parameters. $ components = $ this -> getHttpParameters ( ) ; $ matched = false ; foreach ( self :: getRoutes ( ) as $ route ) { if ( preg_match ( "#^{$route['uri']}$#" , $ uri , $ matches ) ) { Logger :: get ( ) -> debug ( 'Found a matching route: ' . $ route [ 'uri' ] ) ; foreach ( $ route as $ name => $ value ) { switch ( $ name ) { case 'uri' : // Ignore. break ; default : if ( is_numeric ( $ value ) ) { // If the value is a number, it refers to a // regex block in the route. if ( isset ( $ matches [ $ value ] ) ) { $ components [ $ name ] = $ matches [ $ value ] ; } } else { // Otherwise it's the parameter's value. $ components [ $ name ] = $ value ; } break ; } } $ matched = true ; break ; } } // If no matching routes have been found, the request is not // considered valid. if ( ! $ matched ) { throw new Exception ( "No routes match URI '{$uri}'." , 404 ) ; } } return $ components ; }
Extracts the responder, action and parameter from an HTTP request.
Extracts the responder action and parameter from an HTTP request .