Code Duplication    Length = 8-8 lines in 2 locations

src/Controller/AbstractController.php 1 location

@@ 196-203 (lines=8) @@
193
        $config = $this->getServiceLocator()->get(Config::class);
194
        $routes = $config->get('routes');
195
196
        foreach ($routes as $routeName => $routeConfig) {
197
198
            if ($routeName === $name) {
199
                $path = preg_replace('|/\((.*)\)|', '', $routeConfig['path']);
200
                break;
201
            }
202
203
        }
204
205
        if (empty($path)) {
206
            throw new RouteInvalidException(

src/View/Helper/Route.php 1 location

@@ 45-52 (lines=8) @@
42
43
        $path   = '';
44
45
        foreach ($routes as $routeName => $data) {
46
47
            if ($routeName === $name) {
48
                $path = preg_replace('|/\((.*)\)|', '', $data['path']);
49
                break;
50
            }
51
52
        }
53
54
        if (empty($path)) {
55
            throw new RouteInvalidException('No route for name "' . $name . '" found');