Completed
Pull Request — develop (#579)
by Narcotic
41:51 queued 21:51
created

DefaultController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 28
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
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
     * @param ServiceConverter $manager Api Service to Find the Needed response data
22
     * @param Request          $request Sf Request data
23
     * @ParamConverter("manager", converter="graviton.analytics.request_service_converter")
24
     * @return JsonResponse
25
     */
26
    public function serviceAction(ServiceConverter $manager, Request $request)
27
    {
28
        $data = $manager->getData();
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 serviceSchemaAction(ServiceConverter $manager, Request $request)
40
    {
41
        $data = $manager->getSchema();
42
43
        return new JsonResponse($data);
44
    }
45
}
46