protected function prepareRoutePath(RouteContract $route, array $parameters): string
    {
        $parameters = \array_replace($route->getParameters(), $parameters);

        // First we will construct the entire URI including the root and query string. Once it
        // has been constructed, we'll make sure we don't have any missing parameters or we
        // will need to throw the exception to let the developers know one was not given.
        $path = $this->addQueryString(
            $this->replaceRouteParameters($route->getUri(), $parameters),
            $parameters
        );

        \preg_match('/\\{(.*?)\\}/', $path, $matches);

        if (isset($matches[1]) && $matches[1] !== '') {
            throw new UrlGenerationException($route);
        }

        $path = $this->replacePathSegments($path);

        // Once we have ensured that there are no missing parameters in the URI we will encode
        // the URI and prepare it for returning to the developer.
        return \strtr(\rawurlencode($path), self::$dontEncode);
    }