Hypernode\Magento\Command\Hypernode\Performance\PerformanceCommand::replaceUrlByParse PHP Method

replaceUrlByParse() protected method

Replaces the Sitemap URL
protected replaceUrlByParse ( $sitemapUrl, $replaceUrl ) : mixed
$sitemapUrl
$replaceUrl
return mixed
    protected function replaceUrlByParse($sitemapUrl, $replaceUrl)
    {
        $toReplace = $this->matchUrls($sitemapUrl, $replaceUrl)['mismatches'];
        foreach ($toReplace as $replacement) {
            if ($replacement === "port") {
                // @todo output error that ports are not supported yet
            } else {
                $sitemapUrl = str_replace(parse_url($sitemapUrl)[$replacement], parse_url($replaceUrl)[$replacement], $sitemapUrl);
            }
        }
        return (string) $sitemapUrl;
    }