public function calculateUri($uri)
    {
        if ('' != $uri && '/' != $uri[0] && strpos($uri, '://')) {
            $uri = parse_url($uri, PHP_URL_PATH);
        }

        $uri = Uri\normalize(preg_replace('|/+|', '/', $uri));
        $baseUri = Uri\normalize($this->getBaseUri());

        if (0 === strpos($uri, $baseUri)) {
            return trim(HTTP\decodePath(substr($uri, strlen($baseUri))), '/');

        // A special case, if the baseUri was accessed without a trailing
        // slash, we'll accept it as well.
        } elseif ($uri.'/' === $baseUri) {
            return '';
        } else {
            throw new Exception\Forbidden('Requested uri ('.$uri.') is out of base uri ('.$this->getBaseUri().')');
        }
    }
public function calculateUri($uri)
    {
        if ('' != $uri && '/' != $uri[0] && strpos($uri, '://')) {
            $uri = parse_url($uri, PHP_URL_PATH);
        }

        $uri = Uri\normalize(preg_replace('|/+|', '/', $uri));
        $baseUri = Uri\normalize($this->getBaseUri());

        if (0 === strpos($uri, $baseUri)) {
            return trim(HTTP\decodePath(substr($uri, strlen($baseUri))), '/');

        // A special case, if the baseUri was accessed without a trailing
        // slash, we'll accept it as well.
        } elseif ($uri.'/' === $baseUri) {
            return '';
        } else {
            throw new Exception\Forbidden('Requested uri ('.$uri.') is out of base uri ('.$this->getBaseUri().')');
        }
    }
public function calculateUri ( $ uri ) { if ( '' != $ uri && '/' != $ uri [ 0 ] && strpos ( $ uri , '://' ) ) { $ uri = parse_url ( $ uri , PHP_URL_PATH ) ; } $ uri = Uri \ normalize ( preg_replace ( '|/+|' , '/' , $ uri ) ) ; $ baseUri = Uri \ normalize ( $ this -> getBaseUri ( ) ) ; if ( 0 === strpos ( $ uri , $ baseUri ) ) { return trim ( HTTP \ decodePath ( substr ( $ uri , strlen ( $ baseUri ) ) ) , '/' ) ; // A special case, if the baseUri was accessed without a trailing // slash, we'll accept it as well. } elseif ( $ uri . '/' === $ baseUri ) { return '' ; } else { throw new Exception \ Forbidden ( 'Requested uri (' . $ uri . ') is out of base uri (' . $ this -> getBaseUri ( ) . ')' ) ; } }
Turns a URI such as the REQUEST_URI into a local path.

This method:
* strips off the base path
* normalizes the path
* uri-decodes the path

@param string $uri

@throws Exception\Forbidden A permission denied exception is thrown whenever there was an attempt to supply a uri outside of the base uri

@return string
Turns a URI such as the REQUEST_URI into a local path .