DefaultsController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 9 2
A whoAction() 0 8 1
1
<?php
2
3
namespace ApiBundle\Controller;
4
5
use FOS\RestBundle\Controller\FOSRestController;
6
use FOS\RestBundle\Routing\ClassResourceInterface;
7
use Symfony\Component\HttpFoundation\JsonResponse;
8
9
class DefaultsController extends FOSRestController implements ClassResourceInterface
10
{
11
    public function indexAction()
12
    {
13
        if ($this->get('kernel')->getEnvironment() !== 'dev') {
14
            header('HTTP/1.0 403 Forbidden');
15
            exit('You are not allowed to access this route.');
0 ignored issues
show
Coding Style Compatibility introduced by
The method indexAction() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
16
        }
17
18
        return $this->render('default/index.html.twig');
19
    }
20
21
    public function whoAction()
22
    {
23
        return new JsonResponse([
24
            'name' => 'cmobi-service-standard',
25
            'Author' => 'Conta.MOBI S.A.',
26
            'contact' => 'Conta.MOBI <[email protected]>'
27
        ]);
28
    }
29
}
30