AppController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 30
ccs 6
cts 10
cp 0.6
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setContainer() 0 5 1
A indexAction() 0 4 1
A resetApiKeyAction() 0 7 1
1
<?php
2
3
namespace Overwatch\UserBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
10
/**
11
 * AppController
12
 * Renders the initial view to pass frontend off to AngularJS
13
 */
14
class AppController extends Controller
0 ignored issues
show
Coding Style introduced by
The property $_em is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
15
{
16
    private $_em;
17
    
18 2
    public function setContainer(ContainerInterface $container = null)
19
    {
20 2
        parent::setContainer($container);
21 2
        $this->_em = $this->getDoctrine()->getManager();
22 2
    }
23
    
24
    /**
25
     * @Route("")
26
     * @Template("::base_angular.html.twig")
27
     */
28 2
    public function indexAction()
29
    {
30 2
        return [];
31
    }
32
    
33
    /**
34
     * @Route("/profile/reset-api-key")
35
     */
36
    public function resetApiKeyAction()
37
    {
38
        $this->getUser()->resetApiKey();
39
        $this->_em->flush();
40
        
41
        return $this->redirect($this->generateUrl('overwatch_user_app_index') . '#/my-account');
42
    }
43
}
44