Code Duplication    Length = 8-8 lines in 2 locations

src/View/Helper/Route.php 1 location

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

src/Controller/AbstractController.php 1 location

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