public function withScheme($scheme)
    {
        $scheme = strtolower($scheme);
        $pattern = new UriPattern();

        if (strlen($scheme) === 0 || $pattern->matchScheme($scheme)) {
            return $this->with('scheme', $scheme);
        }

        throw new \InvalidArgumentException("Invalid scheme '$scheme'");
    }
public function withScheme($scheme)
    {
        $scheme = strtolower($scheme);
        $pattern = new UriPattern();

        if (strlen($scheme) === 0 || $pattern->matchScheme($scheme)) {
            return $this->with('scheme', $scheme);
        }

        throw new \InvalidArgumentException("Invalid scheme '$scheme'");
    }
public function withScheme ( $ scheme ) { $ scheme = strtolower ( $ scheme ) ; $ pattern = new UriPattern ( ) ; if ( strlen ( $ scheme ) === 0 || $ pattern -> matchScheme ( $ scheme ) ) { return $ this -> with ( 'scheme' , $ scheme ) ; } throw new \ InvalidArgumentException ( "Invalid scheme '$scheme'" ) ; }
Returns a URI instance with the specified scheme.

This method allows all different kinds of schemes. Note, however, that
the different components are only validated based on the generic URI
syntax. No additional validation is performed based on the scheme. An
empty string can be used to remove the scheme. Note that the provided
scheme will be normalized to lowercase.

@param string $scheme The scheme to use with the new instance
@return static A new instance with the specified scheme
@throws \InvalidArgumentException If the scheme is invalid
Returns a URI instance with the specified scheme .