Code Duplication    Length = 12-12 lines in 2 locations

src/AppBundle/Controller/Api/DefaultController.php 2 locations

@@ 145-156 (lines=12) @@
142
            ->setMaxResults(3));
143
        $sortNews = array_fill_keys(['events', 'surveys', 'requests'], []);
144
        $calendar = $this->get('app.google_calendar');
145
        foreach ($news as $new) {
146
            if ($new instanceof Event) {
147
                $sortNews['events'][] = new DtoEvent($calendar
148
                    ->getEventById($new->getGoogleId()));
149
            }
150
            if ($new instanceof Survey) {
151
                $sortNews['surveys'][] = $new;
152
            }
153
            if ($new instanceof FormRequest) {
154
                $sortNews['requests'][] = $new;
155
            }
156
        }
157
158
        return $this->json(
159
            ['news' => $sortNews]
@@ 96-107 (lines=12) @@
93
            ->setMaxResults(3));
94
        $sortNews = array_fill_keys(['events', 'surveys', 'requests'], []);
95
        $calendar = $this->get('app.google_calendar');
96
        foreach ($news as $new) {
97
            if ($new instanceof Event) {
98
                $sortNews['events'][] = new DtoEvent($calendar
99
                    ->getEventById($new->getGoogleId()));
100
            }
101
            if ($new instanceof Survey) {
102
                $sortNews['surveys'][] = $new;
103
            }
104
            if ($new instanceof FormRequest) {
105
                $sortNews['requests'][] = $new;
106
            }
107
        }
108
        $googleEvents = [];
109
        foreach ($events as $event) {
110
            $googleEvents[] = $calendar