Code Duplication    Length = 23-25 lines in 2 locations

src/AppBundle/Controller/VariableController.php 2 locations

@@ 40-64 (lines=25) @@
37
     * @return Response
38
     */
39
40
    public function getAction($name)
41
    {
42
        /** @var Service $vars */
43
        $vars = $this->get('vars');
44
45
        /** @var Variable $var */
46
        $var = $vars->get($name);
47
48
        if (!$var) {
49
            return $this->sendResponse(
50
                false,
51
                [
52
                    'message'=>'Variable not found',
53
                ]
54
            );
55
        }
56
57
        return $this->sendResponse(
58
            true,
59
            [
60
                    'name'=>$var->getName(),
61
                    'value'=>$var->getValue(),
62
            ]
63
        );
64
    }
65
66
    /**
67
     * @Route("/set/{name}", methods={"GET"})
@@ 73-95 (lines=23) @@
70
     * @return Response
71
     * @throws \Exception
72
     */
73
    public function putAction(Request $request, $name)
74
    {
75
76
        $varService = $this->get('vars');
77
78
        $value = $varService->set($name, $request);
79
80
        if (!$value) {
81
            return $this->sendResponse(
82
                true,
83
                [
84
                    'message'=>'Cannot set variable, maybe value param is missing?',
85
                ]
86
            );
87
        }
88
89
        return $this->sendResponse(
90
            true,
91
            [
92
                'message'=>'Set: '.$value,
93
            ]
94
        );
95
    }
96
97
    public function sendResponse($success, array $resp)
98
    {