Mcamara\LaravelLocalization\LaravelLocalization::substituteAttributesInRoute PHP Метод

substituteAttributesInRoute() защищенный Метод

Change route attributes for the ones in the $attributes array
protected substituteAttributesInRoute ( $attributes, string $route ) : string
$attributes array Array of attributes
$route string string route to substitute
Результат string route with attributes changed
    protected function substituteAttributesInRoute($attributes, $route)
    {
        foreach ($attributes as $key => $value) {
            $route = str_replace("{" . $key . "}", $value, $route);
            $route = str_replace("{" . $key . "?}", $value, $route);
        }
        // delete empty optional arguments that are not in the $attributes array
        $route = preg_replace('/\\/{[^)]+\\?}/', '', $route);
        return $route;
    }