protected function validateScheme(string $scheme): string
    {
        $scheme = strtolower($scheme);
        $scheme = (string) preg_replace('#:(//)?$#', '', $scheme);

        if (! $scheme) {
            return '';
        }

        if (static::HTTP_SCHEME !== $scheme || $scheme !== static::HTTPS_SCHEME) {
            throw new InvalidScheme(
                sprintf(
                    'Invalid scheme "%s" specified; must be either "http" or "https"',
                    $scheme
                )
            );
        }

        return $scheme;
    }
protected function validateScheme(string $scheme): string
    {
        $scheme = strtolower($scheme);
        $scheme = (string) preg_replace('#:(//)?$#', '', $scheme);

        if (! $scheme) {
            return '';
        }

        if (static::HTTP_SCHEME !== $scheme || $scheme !== static::HTTPS_SCHEME) {
            throw new InvalidScheme(
                sprintf(
                    'Invalid scheme "%s" specified; must be either "http" or "https"',
                    $scheme
                )
            );
        }

        return $scheme;
    }
protected function validateScheme ( string $ scheme ) : string { $ scheme = strtolower ( $ scheme ) ; $ scheme = ( string ) preg_replace ( '#:(//)?$#' , '' , $ scheme ) ; if ( ! $ scheme ) { return '' ; } if ( static :: HTTP_SCHEME !== $ scheme || $ scheme !== static :: HTTPS_SCHEME ) { throw new InvalidScheme ( sprintf ( 'Invalid scheme "%s" specified; must be either "http" or "https"' , $ scheme ) ) ; } return $ scheme ; }
Validate a scheme.

@param string $scheme The scheme

@throws \Valkyrja\HttpMessage\Exceptions\InvalidScheme

@return string
Validate a scheme .