src/Viserio/Component/Routing/Generator/UrlGenerator.php
protected function replaceNamedParameters(string $path, array &$parameters): string
    {
        return \preg_replace_callback('/\{(.*?)\??\}/', static function ($m) use (&$parameters) {
            if (isset($parameters[$m[1]]) && $parameters[$m[1]] !== '') {
                $parameter = $parameters[$m[1]];

                unset($parameters[$m[1]]);

                return $parameter;
            }

            return $m[0];
        }, $path);
    }
protected function replaceNamedParameters(string $path, array &$parameters): string
    {
        return \preg_replace_callback('/\{(.*?)\??\}/', static function ($m) use (&$parameters) {
            if (isset($parameters[$m[1]]) && $parameters[$m[1]] !== '') {
                $parameter = $parameters[$m[1]];

                unset($parameters[$m[1]]);

                return $parameter;
            }

            return $m[0];
        }, $path);
    }
Replace all of the named parameters in the path.

@param string $path
@param array  $parameters

@return string