Completed
Push — feature/EVO-10415-Analytics-wi... ( a5e3b8...e14dc6 )
by
unknown
132:57 queued 68:01
created

DefaultController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 45
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A indexAction() 0 6 1
A serviceAction() 0 6 1
A serviceSchemaAction() 0 6 1
1
<?php
2
/**
3
 * Entry point controller.
4
 */
5
namespace Graviton\AnalyticsBundle\Controller;
6
7
use Graviton\AnalyticsBundle\Manager\ServiceManager;
8
use Symfony\Component\HttpFoundation\JsonResponse;
9
10
/**
11
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
12
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
13
 * @link     http://swisscom.ch
14
 */
15
class DefaultController
16
{
17
    /** @var ServiceManager */
18
    private $serviceManager;
19
20
    /**
21
     * DefaultController constructor.
22
     * @param ServiceManager $serviceManager Parsing the requested date
23
     */
24
    public function __construct(
25
        ServiceManager $serviceManager
26
    ) {
27
        $this->serviceManager = $serviceManager;
28
    }
29
30
    /**
31
     * @return JsonResponse
32
     */
33
    public function indexAction()
34
    {
35
        $data = $this->serviceManager->getServices();
36
37
        return new JsonResponse($data);
38
    }
39
40
    /**
41
     * @return JsonResponse
42
     */
43
    public function serviceAction()
44
    {
45
        $data = $this->serviceManager->getData();
46
47
        return new JsonResponse($data);
48
    }
49
50
    /**
51
     * @return JsonResponse
52
     */
53
    public function serviceSchemaAction()
54
    {
55
        $data = $this->serviceManager->getSchema();
56
57
        return new JsonResponse($data);
58
    }
59
}
60