Code Duplication    Length = 3-3 lines in 8 locations

src/system/RoutesModule/Controller/Base/AbstractRouteController.php 5 locations

@@ 73-75 (lines=3) @@
70
        // parameter specifying which type of objects we are treating
71
        $objectType = 'route';
72
        $permLevel = $isAdmin ? ACCESS_ADMIN : ACCESS_OVERVIEW;
73
        if (!$this->hasPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel)) {
74
            throw new AccessDeniedException();
75
        }
76
        $templateParameters = [
77
            'routeArea' => $isAdmin ? 'admin' : ''
78
        ];
@@ 133-135 (lines=3) @@
130
        // parameter specifying which type of objects we are treating
131
        $objectType = 'route';
132
        $permLevel = $isAdmin ? ACCESS_ADMIN : ACCESS_READ;
133
        if (!$this->hasPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel)) {
134
            throw new AccessDeniedException();
135
        }
136
        $templateParameters = [
137
            'routeArea' => $isAdmin ? 'admin' : ''
138
        ];
@@ 227-229 (lines=3) @@
224
        // parameter specifying which type of objects we are treating
225
        $objectType = 'route';
226
        $permLevel = $isAdmin ? ACCESS_ADMIN : ACCESS_READ;
227
        if (!$this->hasPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel)) {
228
            throw new AccessDeniedException();
229
        }
230
        // create identifier for permission check
231
        $instanceId = $route->createCompositeIdentifier();
232
        if (!$this->hasPermission($this->name . ':' . ucfirst($objectType) . ':', $instanceId . '::', $permLevel)) {
@@ 300-302 (lines=3) @@
297
        // parameter specifying which type of objects we are treating
298
        $objectType = 'route';
299
        $permLevel = $isAdmin ? ACCESS_ADMIN : ACCESS_EDIT;
300
        if (!$this->hasPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel)) {
301
            throw new AccessDeniedException();
302
        }
303
        $templateParameters = [
304
            'routeArea' => $isAdmin ? 'admin' : ''
305
        ];
@@ 370-372 (lines=3) @@
367
        // parameter specifying which type of objects we are treating
368
        $objectType = 'route';
369
        $permLevel = $isAdmin ? ACCESS_ADMIN : ACCESS_DELETE;
370
        if (!$this->hasPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel)) {
371
            throw new AccessDeniedException();
372
        }
373
        $logger = $this->get('logger');
374
        $logArgs = ['app' => 'ZikulaRoutesModule', 'user' => $this->get('zikula_users_module.current_user')->get('uname'), 'entity' => 'route', 'id' => $route->createCompositeIdentifier()];
375
        

src/system/RoutesModule/Controller/UpdateController.php 3 locations

@@ 43-45 (lines=3) @@
40
    public function reloadAction(Request $request)
41
    {
42
        $objectType = 'route';
43
        if (!$this->hasPermission('ZikulaRoutesModule:' . ucfirst($objectType) . ':', '::', ACCESS_ADMIN)) {
44
            throw new AccessDeniedException();
45
        }
46
47
        $cacheClearer = $this->get('zikula.cache_clearer');
48
        $cacheClearer->clear('symfony.routing');
@@ 75-77 (lines=3) @@
72
    public function renewAction(Request $request)
73
    {
74
        $objectType = 'route';
75
        if (!$this->hasPermission('ZikulaRoutesModule:' . ucfirst($objectType) . ':', '::', ACCESS_ADMIN)) {
76
            throw new AccessDeniedException();
77
        }
78
79
        // Renew the routing settings.
80
        $this->get('zikula_routes_module.multilingual_routing_helper')->reloadMultilingualRoutingSettings();
@@ 105-107 (lines=3) @@
102
    public function dumpJsRoutesAction(Request $request, $lang = null)
103
    {
104
        $objectType = 'route';
105
        if (!$this->hasPermission('ZikulaRoutesModule:' . ucfirst($objectType) . ':', '::', ACCESS_ADMIN)) {
106
            throw new AccessDeniedException();
107
        }
108
109
        $this->dumpJsRoutes($lang);
110