Completed
Pull Request — master (#33)
by Pavel
03:21
created

AccountController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 88.89%

Importance

Changes 8
Bugs 0 Features 5
Metric Value
wmc 2
c 8
b 0
f 5
lcom 1
cbo 3
dl 0
loc 24
ccs 8
cts 9
cp 0.8889
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A showAccountAction() 0 17 2
1
<?php
2
3
namespace AppBundle\Controller\Account;
4
5
use AppBundle\Entity\ModuleUser;
6
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
9
use Symfony\Component\HttpFoundation\Request;
10
use Symfony\Component\HttpFoundation\Response;
11
12
class AccountController extends Controller
13
{
14
    /**
15
     * @Route("/account", name="account")
16
     * @Template("@App/Account/showAccount.html.twig")
17
     */
18 1
    public function showAccountAction(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
    {
20 1
        if ($this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) {
21
            return $this->redirectToRoute('admin');
22
        }
23
24 1
        $user = $this->getUser();
25 1
        $em = $this->getDoctrine()->getManager();
26
27 1
        $modules = $em->getRepository('AppBundle:ModuleUser')
28 1
            ->findModules($user);
29
30
        return [
31 1
            'user' => $user,
32
            'modules' => $modules
33 1
        ];
34
    }
35
}
36