Code Duplication    Length = 12-12 lines in 2 locations

src/Routing/src/UrlGenerator.php 2 locations

@@ 49-60 (lines=12) @@
46
    /**
47
     * @inheritDoc
48
     */
49
    public function toCurrent(array $variables = [], array $query = []): UriInterface
50
    {
51
        $route = $this->request->getRoute();
52
53
        if ($route === null) {
54
            throw new RouteNotFoundException(
55
                sprintf('Unable to generate an URL for current.')
56
            );
57
        }
58
59
        return $this->buildRouteUri($route, $variables, $query);
60
    }
61
62
    /**
63
     * @inheritDoc
@@ 65-76 (lines=12) @@
62
    /**
63
     * @inheritDoc
64
     */
65
    public function toRoute(string $routeName, array $variables = [], array $query = []): UriInterface
66
    {
67
        $route = $this->routes->findByName($routeName);
68
69
        if ($route === null) {
70
            throw new RouteNotFoundException(
71
                sprintf('Unable to generate an URL for the named route "%s" as such route does not exist.', $routeName)
72
            );
73
        }
74
75
        return $this->buildRouteUri($route, $variables, $query);
76
    }
77
78
    /**
79
     * Builds URI for provided route instance.