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

DefaultController::serviceSchemaAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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