Code Duplication    Length = 11-11 lines in 4 locations

src/RunOpenCode/Bundle/ExchangeRate/Controller/RestController.php 4 locations

@@ 40-50 (lines=11) @@
37
        }
38
    }
39
40
    public function getAction($sourceName, $currencyCode, \DateTime $date = null, $rateType = RateType::MEDIAN)
41
    {
42
        try {
43
            return new JsonResponse([
44
                'error' => false,
45
                'result' => $this->rateToArray($this->getManager()->get($sourceName, $currencyCode, $date, $rateType))
46
            ]);
47
        } catch (\Exception $e) {
48
            return $this->exceptionToResponse($e);
49
        }
50
    }
51
52
    public function latestAction($sourceName, $currencyCode, $rateType = RateType::MEDIAN)
53
    {
@@ 52-62 (lines=11) @@
49
        }
50
    }
51
52
    public function latestAction($sourceName, $currencyCode, $rateType = RateType::MEDIAN)
53
    {
54
        try {
55
            return new JsonResponse([
56
                'error' => false,
57
                'result' => $this->rateToArray($this->getManager()->latest($sourceName, $currencyCode, $rateType))
58
            ]);
59
        } catch (\Exception $e) {
60
            return $this->exceptionToResponse($e);
61
        }
62
    }
63
64
    public function todayAction($sourceName, $currencyCode, $rateType = RateType::MEDIAN)
65
    {
@@ 64-74 (lines=11) @@
61
        }
62
    }
63
64
    public function todayAction($sourceName, $currencyCode, $rateType = RateType::MEDIAN)
65
    {
66
        try {
67
            return new JsonResponse([
68
                'error' => false,
69
                'result' => $this->rateToArray($this->getManager()->today($sourceName, $currencyCode, $rateType))
70
            ]);
71
        } catch (\Exception $e) {
72
            return $this->exceptionToResponse($e);
73
        }
74
    }
75
76
    public function historicalAction($sourceName, $currencyCode, \DateTime $date, $rateType = RateType::MEDIAN)
77
    {
@@ 76-86 (lines=11) @@
73
        }
74
    }
75
76
    public function historicalAction($sourceName, $currencyCode, \DateTime $date, $rateType = RateType::MEDIAN)
77
    {
78
        try {
79
            return new JsonResponse([
80
                'error' => false,
81
                'result' => $this->rateToArray($this->getManager()->historical($sourceName, $currencyCode, $date, $rateType))
82
            ]);
83
        } catch (\Exception $e) {
84
            return $this->exceptionToResponse($e);
85
        }
86
    }
87
88
    /**
89
     * Extract params from request.