Spatie\Crawler\Url::isProtocolIndependent PHP Method

isProtocolIndependent() public method

public isProtocolIndependent ( ) : boolean
return boolean
    public function isProtocolIndependent() : bool
    {
        return is_null($this->scheme);
    }

Usage Example

Example #1
0
 /**
  * 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();
 }