Code Duplication    Length = 55-56 lines in 2 locations

src/Graviton/AnalyticsBundle/Controller/DefaultController.php 1 location

@@ 16-71 (lines=56) @@
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class DefaultController
17
{
18
    /** @var ServiceManager */
19
    private $serviceManager;
20
21
    /**
22
     * DefaultController constructor.
23
     * @param ServiceManager $serviceManager Parsing the requested date
24
     */
25
    public function __construct(
26
        ServiceManager $serviceManager
27
    ) {
28
        $this->serviceManager = $serviceManager;
29
    }
30
31
    /**
32
     * @return JsonResponse
33
     */
34
    public function indexAction()
35
    {
36
        $data = $this->serviceManager->getServices();
37
38
        return new JsonResponse($data);
39
    }
40
41
    /**
42
     * @return Response
43
     */
44
    public function optionsAction()
45
    {
46
        $resp = new Response();
47
        $resp->setStatusCode(Response::HTTP_NO_CONTENT);
48
        $resp->headers->set("Access-Control-Allow-Methods", "GET, OPTIONS");
49
        return $resp;
50
    }
51
52
    /**
53
     * @return JsonResponse
54
     */
55
    public function serviceAction()
56
    {
57
        $data = $this->serviceManager->getData();
58
59
        return new JsonResponse($data);
60
    }
61
62
    /**
63
     * @return JsonResponse
64
     */
65
    public function serviceSchemaAction()
66
    {
67
        $data = $this->serviceManager->getSchema();
68
69
        return new JsonResponse($data);
70
    }
71
}
72

src/Graviton/ProxyApiBundle/Controller/DefaultController.php 1 location

@@ 16-70 (lines=55) @@
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class DefaultController
17
{
18
    /** @var ServiceManager */
19
    private $serviceManager;
20
21
    /**
22
     * DefaultController constructor.
23
     * @param ServiceManager $serviceManager Parsing the requested date
24
     */
25
    public function __construct(
26
        ServiceManager $serviceManager
27
    ) {
28
        $this->serviceManager = $serviceManager;
29
    }
30
31
    /**
32
     * @return JsonResponse
33
     */
34
    public function indexAction()
35
    {
36
37
        $data = $this->serviceManager->getServices();
38
39
        return new JsonResponse($data);
40
    }
41
42
    /**
43
     * @return Response
44
     */
45
    public function optionsAction()
46
    {
47
        $resp = new Response();
48
        $resp->setStatusCode(Response::HTTP_NO_CONTENT);
49
        $resp->headers->set("Access-Control-Allow-Methods", "GET, OPTIONS, POST");
50
        return $resp;
51
    }
52
53
    /**
54
     * @return Response
55
     */
56
    public function proxyAction()
57
    {
58
        return $this->serviceManager->processRequest();
59
    }
60
61
    /**
62
     * @return JsonResponse
63
     */
64
    public function schemaAction()
65
    {
66
        $data = $this->serviceManager->getSchema();
67
68
        return new JsonResponse($data);
69
    }
70
}
71