/** * Normalize the given url. * * @param \Spatie\Crawler\Url $url * * @return $this */ protected function normalizeUrl(Url $url) { if ($url->isRelative()) { $url->setScheme($this->baseUrl->scheme)->setHost($this->baseUrl->host)->setPort($this->baseUrl->port); } if ($url->isProtocolIndependent()) { $url->setScheme($this->baseUrl->scheme); } return $url->removeFragment(); }