private static function isValidUriScheme(?string $scheme): bool
    {
        // http://tools.ietf.org/html/rfc3986#section-3
        // The scheme and path components are required, though the path may be
        // empty (no characters)
        if ($scheme === null || $scheme === '') {
            return false;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.1
        // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
        $pattern = '/\A[a-z][a-z0-9+.\-]*\z/i';

        return !!preg_match($pattern, $scheme);
    }
private static function isValidUriScheme(?string $scheme): bool
    {
        // http://tools.ietf.org/html/rfc3986#section-3
        // The scheme and path components are required, though the path may be
        // empty (no characters)
        if ($scheme === null || $scheme === '') {
            return false;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.1
        // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
        $pattern = '/\A[a-z][a-z0-9+.\-]*\z/i';

        return !!preg_match($pattern, $scheme);
    }
private static function isValidUriScheme ( ? string $ scheme ) : bool { // http://tools.ietf.org/html/rfc3986#section-3 // The scheme and path components are required, though the path may be // empty (no characters) if ( $ scheme === null || $ scheme === '' ) { return false ; } // http://tools.ietf.org/html/rfc3986#section-3.1 // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) $ pattern = '/\A[a-z][a-z0-9+.\-]*\z/i' ; return ! ! preg_match ( $ pattern , $ scheme ) ; }
Checks if a URI scheme is valid

@param string|null $scheme The URI scheme

@return bool
Checks if a URI scheme is valid