src/Helper/LanguageSwitcherHelper.php
public function getPathInfo($referrer = null)
    {
        $baseUrl = $this->prepareBaseUrl($referrer);

        if (null === ($referrer)) {
            return '/';
        }

        $pathInfo = '/';

        // Remove the query string from REQUEST_URI
        if ($pos = strpos($referrer, '?')) {
            $referrer = substr($referrer, 0, $pos);
        }

        $host = $this->requestStack->getCurrentRequest()->getHost();
        if ((null !== $baseUrl) && (false === ($pathInfo = substr($referrer, strlen($baseUrl))))) {
            // If substr() returns false then PATH_INFO is set to an empty string
            return '/';
        } elseif (null === $baseUrl) {
            return $referrer;
        } elseif ($pos = strpos($pathInfo, $host)) {
            $pathInfo = substr($pathInfo, $pos + strlen($host));
        }

        return (string) $pathInfo;
    }
public function getPathInfo($referrer = null)
    {
        $baseUrl = $this->prepareBaseUrl($referrer);

        if (null === ($referrer)) {
            return '/';
        }

        $pathInfo = '/';

        // Remove the query string from REQUEST_URI
        if ($pos = strpos($referrer, '?')) {
            $referrer = substr($referrer, 0, $pos);
        }

        $host = $this->requestStack->getCurrentRequest()->getHost();
        if ((null !== $baseUrl) && (false === ($pathInfo = substr($referrer, strlen($baseUrl))))) {
            // If substr() returns false then PATH_INFO is set to an empty string
            return '/';
        } elseif (null === $baseUrl) {
            return $referrer;
        } elseif ($pos = strpos($pathInfo, $host)) {
            $pathInfo = substr($pathInfo, $pos + strlen($host));
        }

        return (string) $pathInfo;
    }
public function getPathInfo ( $ referrer = null ) { $ baseUrl = $ this -> prepareBaseUrl ( $ referrer ) ; if ( null === ( $ referrer ) ) { return '/' ; } $ pathInfo = '/' ; // Remove the query string from REQUEST_URI if ( $ pos = strpos ( $ referrer , '?' ) ) { $ referrer = substr ( $ referrer , 0 , $ pos ) ; } $ host = $ this -> requestStack -> getCurrentRequest ( ) -> getHost ( ) ; if ( ( null !== $ baseUrl ) && ( false === ( $ pathInfo = substr ( $ referrer , strlen ( $ baseUrl ) ) ) ) ) { // If substr() returns false then PATH_INFO is set to an empty string return '/' ; } elseif ( null === $ baseUrl ) { return $ referrer ; } elseif ( $ pos = strpos ( $ pathInfo , $ host ) ) { $ pathInfo = substr ( $ pathInfo , $ pos + strlen ( $ host ) ) ; } return ( string ) $ pathInfo ; }
Returns the uri Path for the current uri if no referrer given,
otherwise it returns the path for the URL given.

@param null $referrer

@return null|string
Returns the uri Path for the current uri if no referrer given otherwise it returns the path for the URL given .