private function getUriForSite($pathinfo, Site $site = null)
    {
        $siteUsed = $this->getCurrentSite($site);
        if (null === $siteUsed || null === $this->application) {
            return $pathinfo;
        }

        $protocol = '';
        if (null === parse_url($siteUsed->getServerName(), PHP_URL_SCHEME)) {
            $protocol = (string) $this->defaultScheme;
            $protocol = $protocol . ($protocol ? ':' : '') . '//';
        }

        return $protocol . $siteUsed->getServerName() . $pathinfo;
    }