Completed
Push — master ( a7cf71...06c6ea )
by Craig
06:43
created

AbstractUserController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 29
loc 29
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 15 15 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Routes.
4
 *
5
 * @copyright Zikula contributors (Zikula)
6
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
7
 * @author Zikula contributors <[email protected]>.
8
 * @link http://www.zikula.org
9
 * @link http://zikula.org
10
 * @version Generated by ModuleStudio 0.7.0 (http://modulestudio.de).
11
 */
12
13
namespace Zikula\RoutesModule\Controller\Base;
14
15
use Symfony\Component\HttpFoundation\Request;
16
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
17
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
18
use Symfony\Component\HttpFoundation\RedirectResponse;
19
use ModUtil;
20
use RuntimeException;
21
use System;
22
use Zikula\Core\Controller\AbstractController;
23
use Zikula\Core\RouteUrl;
24
use Zikula\Core\Response\PlainResponse;
25
26
/**
27
 * User controller class.
28
 */
29 View Code Duplication
abstract class AbstractUserController extends AbstractController
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
{
31
32
    /**
33
     * This is the default action handling the index area called without defining arguments.
34
     *
35
     * @param Request  $request      Current request instance
36
     *
37
     * @return mixed Output
38
     *
39
     * @throws AccessDeniedException Thrown if the user doesn't have required permissions
40
     */
41
    public function indexAction(Request $request)
42
    {
43
        // parameter specifying which type of objects we are treating
44
        $objectType = $request->query->getAlnum('ot', 'route');
45
        
46
        $permLevel = ACCESS_OVERVIEW;
47
        if (!$this->hasPermission($this->name . '::', '::', $permLevel)) {
48
            throw new AccessDeniedException();
49
        }
50
        
51
        // redirect to view action
52
        $routeArea = '';
53
        
54
        return $this->redirectToRoute('zikularoutesmodule_' . strtolower($objectType) . '_' . $routeArea . 'view');
55
    }
56
57
}
58