protected function getSystemUri($requestUri = null, $refresh = false)
    {
        if ($this->psrUri && !$refresh) {
            return $this->psrUri;
        }

        $uri = $requestUri ? new PsrUri($requestUri) : $this->getRequest()->getUri();

        $server = $this->getRequest()->getServerParams();

        // If we are working from a CGI SAPI with the 'cgi.fix_pathinfo' directive disabled we use PHP_SELF.
        if (strpos(PHP_SAPI, 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($server['REQUEST_URI'])) {
            // We aren't expecting PATH_INFO within PHP_SELF so this should work.
            $uri = $uri->withPath(rtrim(\dirname((string) ServerHelper::getValue($server, 'PHP_SELF')), '/\\'));
        } else {
            // Pretty much everything else should be handled with SCRIPT_NAME.
            $uri = $uri->withPath(rtrim(\dirname((string) ServerHelper::getValue($server, 'SCRIPT_NAME')), '/\\'));
        }

        // Clear the unused parts of the requested URI.
        $uri = $uri->withFragment('');

        return $this->psrUri = $uri;
    }
protected function getSystemUri($requestUri = null, $refresh = false)
    {
        if ($this->psrUri && !$refresh) {
            return $this->psrUri;
        }

        $uri = $requestUri ? new PsrUri($requestUri) : $this->getRequest()->getUri();

        $server = $this->getRequest()->getServerParams();

        // If we are working from a CGI SAPI with the 'cgi.fix_pathinfo' directive disabled we use PHP_SELF.
        if (strpos(PHP_SAPI, 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($server['REQUEST_URI'])) {
            // We aren't expecting PATH_INFO within PHP_SELF so this should work.
            $uri = $uri->withPath(rtrim(\dirname((string) ServerHelper::getValue($server, 'PHP_SELF')), '/\\'));
        } else {
            // Pretty much everything else should be handled with SCRIPT_NAME.
            $uri = $uri->withPath(rtrim(\dirname((string) ServerHelper::getValue($server, 'SCRIPT_NAME')), '/\\'));
        }

        // Clear the unused parts of the requested URI.
        $uri = $uri->withFragment('');

        return $this->psrUri = $uri;
    }
protected function getSystemUri ( $ requestUri = null , $ refresh = false ) { if ( $ this -> psrUri && ! $ refresh ) { return $ this -> psrUri ; } $ uri = $ requestUri ? new PsrUri ( $ requestUri ) : $ this -> getRequest ( ) -> getUri ( ) ; $ server = $ this -> getRequest ( ) -> getServerParams ( ) ; // If we are working from a CGI SAPI with the 'cgi.fix_pathinfo' directive disabled we use PHP_SELF. if ( strpos ( PHP_SAPI , 'cgi' ) !== false && ! ini_get ( 'cgi.fix_pathinfo' ) && ! empty ( $ server [ 'REQUEST_URI' ] ) ) { // We aren't expecting PATH_INFO within PHP_SELF so this should work. $ uri = $ uri -> withPath ( rtrim ( \ dirname ( ( string ) ServerHelper :: getValue ( $ server , 'PHP_SELF' ) ) , '/\\' ) ) ; } else { // Pretty much everything else should be handled with SCRIPT_NAME. $ uri = $ uri -> withPath ( rtrim ( \ dirname ( ( string ) ServerHelper :: getValue ( $ server , 'SCRIPT_NAME' ) ) , '/\\' ) ) ; } // Clear the unused parts of the requested URI. $ uri = $ uri -> withFragment ( '' ) ; return $ this -> psrUri = $ uri ; }
Get system Uri object.

@param   string $requestUri The request uri string.
@param   bool   $refresh    Refresh the uri.

@return  PsrUri  The system Uri object.

@since   2.0
Get system Uri object .