Code Duplication    Length = 8-8 lines in 2 locations

src/Controller/AbstractController.php 1 location

@@ 171-178 (lines=8) @@
168
        $config = $this->getServiceLocator()->get(Config::class);
169
        $routes = $config->get('routes');
170
171
        foreach ($routes as $routeName => $routeConfig) {
172
173
            if ($routeName === $name) {
174
                $path = preg_replace('|/\((.*)\)|', '', $routeConfig['path']);
175
                break;
176
            }
177
178
        }
179
180
        if (empty($path)) {
181
            throw new RouteInvalidException('No route for name "' . $name . '" found');

src/View/Helper/Route.php 1 location

@@ 37-44 (lines=8) @@
34
        $routes = $config->get('routes');
35
        $path   = '';
36
37
        foreach ($routes as $routeName => $data) {
38
39
            if ($routeName === $name) {
40
                $path = preg_replace('|/\((.*)\)|', '', $data['path']);
41
                break;
42
            }
43
44
        }
45
46
        if (empty($path)) {
47
            throw new RouteInvalidException('No route for name "' . $name . '" found');