AdminController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 85.71%

Importance

Changes 7
Bugs 0 Features 1
Metric Value
wmc 2
c 7
b 0
f 1
lcom 0
cbo 3
dl 0
loc 40
ccs 12
cts 14
cp 0.8571
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A successAction() 0 4 1
A indexAction() 0 18 1
1
<?php
2
3
namespace AppBundle\Controller\Admin;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
10
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
11
use Symfony\Component\HttpFoundation\Request;
12
13
/**
14
 * Class AdminController
15
 * @package AppBundle\Controller\Admin
16
 * @Route("/admin")
17
 */
18
class AdminController extends Controller
19
{
20
    /**
21
     * @Method("GET")
22
     * @Route("/", name="mainAdmin")
23
     * @Template("AppBundle:admin:main.html.twig")
24
     *
25
     * @return Response
26
     */
27 1
    public function indexAction()
28
    {
29 1
        $em = $this->getDoctrine()->getManager();
30 1
        $countArticles = $em->getRepository("AppBundle:Article")
31 1
            ->getCountArticles();
32
33 1
        $countComments = $em->getRepository("AppBundle:Comment")
34 1
            ->getCountComments();
35
36 1
        $countUsers = $em->getRepository("AppBundle:User")
37 1
            ->getCountUsers();
38
39
        return [
40 1
            'countArticles' => $countArticles['countArticles'],
41 1
            'countComments' => $countComments['countComments'],
42 1
            'countUsers'    => $countUsers['countUsers'],
43 1
        ];
44
    }
45
46
    /**
47
     * @Route("/success", name="successAdmin")
48
     * @Template("AppBundle:blog:success.html.twig")
49
     *
50
     * @return Response
51
     */
52
    public function successAction()
53
    {
54
        return [];
55
    }
56
57
}
58