Networking\InitCmsBundle\Helper\LanguageSwitcherHelper::getPathInfo PHP Метод

getPathInfo() публичный Метод

Returns the uri Path for the current uri if no referrer given, otherwise it returns the path for the URL given
public getPathInfo ( null $referrer = null ) : null | string
$referrer null
Результат null | string
    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->request->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;
    }