AppController::resetApiKeyAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 2
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