Completed
Push — feature/EVO-10415-Analytics-wi... ( e2b3ad )
by
unknown
12:30
created

DefaultController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 41
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
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\Request\ParamConverter\ServiceConverter;
8
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9
use Symfony\Component\HttpFoundation\JsonResponse;
10
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
11
use Symfony\Component\HttpFoundation\Request;
12
13
/**
14
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
15
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
16
 * @link     http://swisscom.ch
17
 */
18
class DefaultController extends Controller
19
{
20
21
    /**
22
     * @param ServiceConverter $manager Api Service to Find the Needed response data
23
     * @ParamConverter("manager", converter="graviton.analytics.request_service_converter")
24
     * @return JsonResponse
25
     */
26
    public function indexAction(ServiceConverter $manager)
27
    {
28
        $data = $manager->getServices();
29
30
        return new JsonResponse($data);
31
    }
32
33
    /**
34
     * @param ServiceConverter $manager Api Service to Find the Needed response data
35
     * @param Request          $request Sf Request data
36
     * @ParamConverter("manager", converter="graviton.analytics.request_service_converter")
37
     * @return JsonResponse
38
     */
39
    public function serviceAction(ServiceConverter $manager, Request $request)
40
    {
41
        $data = $manager->getData($request->get('service'));
42
43
        return new JsonResponse($data);
44
    }
45
46
    /**
47
     * @param ServiceConverter $manager Api Service to Find the Needed response data
48
     * @param Request          $request Sf Request data
49
     * @ParamConverter("manager", converter="graviton.analytics.request_service_converter")
50
     * @return JsonResponse
51
     */
52
    public function serviceSchemaAction(ServiceConverter $manager, Request $request)
53
    {
54
        $data = $manager->getSchema($request->get('service'));
55
56
        return new JsonResponse($data);
57
    }
58
}
59