src/Mvc/Util/RequestParser.php
private static function parseUri(Request &$request,
    		$uri, $defaultController, $defaultAction)
    {
        // All beyond the context prefix is our application request uri
        $contextUri = $uri;
        if (null != $request->getContextPrefix() && '/' != $request->getContextPrefix()) {
        	$contextUri = str_replace($request->getContextPrefix(), '', $uri);
        }
        
        // Split parts
        $parts = array();
        if ($contextUri != '') {
            while (isset($contextUri[0]) && $contextUri[0] == '/') {
                $contextUri = substr($contextUri, 1);
            }
            $parts = explode('/', $contextUri);
        }
        
        // Check if there was a controller requested
        if (count($parts) > 0) {
            $request->setController( ucfirst(trim($parts[0])) );
            array_shift($parts);
            if (! $request->getController()) {
                $request->setController( $defaultController );
            }
        }
        
        // Check if there was an action requested
        if (count($parts) > 0) {
            $request->setAction( trim($parts[0]) );
            array_shift($parts);
            if (! $request->getAction()) {
                $request->setAction( $defaultAction );
            }
        }
        
        return $parts;
    }
private static function parseUri(Request &$request,
    		$uri, $defaultController, $defaultAction)
    {
        // All beyond the context prefix is our application request uri
        $contextUri = $uri;
        if (null != $request->getContextPrefix() && '/' != $request->getContextPrefix()) {
        	$contextUri = str_replace($request->getContextPrefix(), '', $uri);
        }
        
        // Split parts
        $parts = array();
        if ($contextUri != '') {
            while (isset($contextUri[0]) && $contextUri[0] == '/') {
                $contextUri = substr($contextUri, 1);
            }
            $parts = explode('/', $contextUri);
        }
        
        // Check if there was a controller requested
        if (count($parts) > 0) {
            $request->setController( ucfirst(trim($parts[0])) );
            array_shift($parts);
            if (! $request->getController()) {
                $request->setController( $defaultController );
            }
        }
        
        // Check if there was an action requested
        if (count($parts) > 0) {
            $request->setAction( trim($parts[0]) );
            array_shift($parts);
            if (! $request->getAction()) {
                $request->setAction( $defaultAction );
            }
        }
        
        return $parts;
    }
private static function parseUri ( Request & $ request , $ uri , $ defaultController , $ defaultAction ) { // All beyond the context prefix is our application request uri $ contextUri = $ uri ; if ( null != $ request -> getContextPrefix ( ) && '/' != $ request -> getContextPrefix ( ) ) { $ contextUri = str_replace ( $ request -> getContextPrefix ( ) , '' , $ uri ) ; } // Split parts $ parts = array ( ) ; if ( $ contextUri != '' ) { while ( isset ( $ contextUri [ 0 ] ) && $ contextUri [ 0 ] == '/' ) { $ contextUri = substr ( $ contextUri , 1 ) ; } $ parts = explode ( '/' , $ contextUri ) ; } // Check if there was a controller requested if ( count ( $ parts ) > 0 ) { $ request -> setController ( ucfirst ( trim ( $ parts [ 0 ] ) ) ) ; array_shift ( $ parts ) ; if ( ! $ request -> getController ( ) ) { $ request -> setController ( $ defaultController ) ; } } // Check if there was an action requested if ( count ( $ parts ) > 0 ) { $ request -> setAction ( trim ( $ parts [ 0 ] ) ) ; array_shift ( $ parts ) ; if ( ! $ request -> getAction ( ) ) { $ request -> setAction ( $ defaultAction ) ; } } return $ parts ; }
Parse the prepared uri into its parts

@param Request $request
The unprepared request object
@param string $uri
The prepared uri
@param string $defaultController
The name of default controller if nothing is requested
@param string $defaultAction
The name of default action if nothing is requested

@return array Parsed parts for later usage
Parse the prepared uri into its parts