src/Domain/Value/Identifier/Uri.php
protected static function decode(string $component, string $allowed): string
    {
        $allowed = sprintf('/[%s]/', $allowed);
        $encoded = sprintf('/%s/', static::PCT_ENCODED_SET);

        return preg_replace_callback($encoded, function ($matches) use ($allowed) {
            $char = rawurldecode($matches[0]);

            if (preg_match($allowed, $char)) {
                return $char;
            }

            return strtoupper($matches[0]);
        }, $component);
    }
protected static function decode(string $component, string $allowed): string
    {
        $allowed = sprintf('/[%s]/', $allowed);
        $encoded = sprintf('/%s/', static::PCT_ENCODED_SET);

        return preg_replace_callback($encoded, function ($matches) use ($allowed) {
            $char = rawurldecode($matches[0]);

            if (preg_match($allowed, $char)) {
                return $char;
            }

            return strtoupper($matches[0]);
        }, $component);
    }
protected static function decode ( string $ component , string $ allowed ) : string { $ allowed = sprintf ( '/[%s]/' , $ allowed ) ; $ encoded = sprintf ( '/%s/' , static :: PCT_ENCODED_SET ) ; return preg_replace_callback ( $ encoded , function ( $ matches ) use ( $ allowed ) { $ char = rawurldecode ( $ matches [ 0 ] ) ; if ( preg_match ( $ allowed , $ char ) ) { return $ char ; } return strtoupper ( $ matches [ 0 ] ) ; } , $ component ) ; }
Decodes a component

@param string $component The component
@param string $allowed   The set of allowed characters

@return string
Decodes a component