src/Url.php
public function withScheme(SchemeInterface $scheme, bool $keepDefaultPort = true): UrlInterface
    {
        return new self($scheme, $this->myHost, ($keepDefaultPort && $this->myPort === $this->myScheme->getDefaultPort() ? $scheme->getDefaultPort() : $this->myPort), $this->myPath, $this->myQueryString, $this->myFragment);
    }
public function withScheme(SchemeInterface $scheme, bool $keepDefaultPort = true): UrlInterface
    {
        return new self($scheme, $this->myHost, ($keepDefaultPort && $this->myPort === $this->myScheme->getDefaultPort() ? $scheme->getDefaultPort() : $this->myPort), $this->myPath, $this->myQueryString, $this->myFragment);
    }
public function withScheme ( SchemeInterface $ scheme , bool $ keepDefaultPort = true ) : UrlInterface { return new self ( $ scheme , $ this -> myHost , ( $ keepDefaultPort && $ this -> myPort === $ this -> myScheme -> getDefaultPort ( ) ? $ scheme -> getDefaultPort ( ) : $ this -> myPort ) , $ this -> myPath , $ this -> myQueryString , $ this -> myFragment ) ; }
Returns a copy of the Url instance with the specified scheme.

@since 1.0.0

@param SchemeInterface $scheme          The scheme.
@param bool            $keepDefaultPort If true, port is changed to the schemes default port if port is current schemes default port, if false port is not changed.

@return UrlInterface The Url instance.
Returns a copy of the Url instance with the specified scheme .