src/Domain/Value/Identifier/Uri.php
protected static function isValidFragment(?string $fragment): bool
    {
        if ($fragment === null || $fragment === '') {
            return true;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.5
        // fragment = *( pchar / "/" / "?" )
        // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
        $pattern = sprintf(
            '/\A(?:[%s%s\/?:@]|(?:%s))*\z/',
            static::UNRESERVED_SET,
            static::SUB_DELIMS_SET,
            static::PCT_ENCODED_SET
        );

        return !!preg_match($pattern, $fragment);
    }
protected static function isValidFragment(?string $fragment): bool
    {
        if ($fragment === null || $fragment === '') {
            return true;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.5
        // fragment = *( pchar / "/" / "?" )
        // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
        $pattern = sprintf(
            '/\A(?:[%s%s\/?:@]|(?:%s))*\z/',
            static::UNRESERVED_SET,
            static::SUB_DELIMS_SET,
            static::PCT_ENCODED_SET
        );

        return !!preg_match($pattern, $fragment);
    }
protected static function isValidFragment ( ? string $ fragment ) : bool { if ( $ fragment === null || $ fragment === '' ) { return true ; } // http://tools.ietf.org/html/rfc3986#section-3.5 // fragment = *( pchar / "/" / "?" ) // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" $ pattern = sprintf ( '/\A(?:[%s%s\/?:@]|(?:%s))*\z/' , static :: UNRESERVED_SET , static :: SUB_DELIMS_SET , static :: PCT_ENCODED_SET ) ; return ! ! preg_match ( $ pattern , $ fragment ) ; }
Checks if a fragment is valid

@param string|null $fragment The fragment

@return bool
Checks if a fragment is valid