Code Duplication    Length = 12-12 lines in 2 locations

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

@@ 94-105 (lines=12) @@
91
            ->setMaxResults(3));
92
        $sortNews = array_fill_keys(['events', 'surveys', 'requests'], false);
93
        $calendar = $this->get('app.google_calendar');
94
        foreach ($news as $new) {
95
            if ($new instanceof Event) {
96
                $sortNews['events'][] = new DtoEvent($calendar
97
                    ->getEventById($new->getGoogleId()));
98
            }
99
            if ($new instanceof Survey) {
100
                $sortNews['surveys'][] = $new;
101
            }
102
            if ($new instanceof FormRequest) {
103
                $sortNews['requests'][] = $new;
104
            }
105
        }
106
        $events = $events->matching(Criteria::create()->setFirstResult(0)->setMaxResults(2));
107
        $googleEvents = [];
108
        foreach ($events as $event) {
@@ 145-156 (lines=12) @@
142
            ->setMaxResults(3));
143
        $sortNews = array_fill_keys(['events', 'surveys', 'requests'], false);
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]