Code Duplication    Length = 8-10 lines in 5 locations

src/Controller/Api/PerformancesController.php 2 locations

@@ 54-63 (lines=10) @@
51
52
        $performancesTranslated = array();
53
54
        foreach ($performances as $performance) {
55
            $performance->setLocale($paramFetcher->get('locale'));
56
            $em->refresh($performance);
57
58
            if ($performance->getTranslations()) {
59
                $performance->unsetTranslations();
60
            }
61
62
            $performancesTranslated[] = $performance;
63
        }
64
65
        $performances = $performancesTranslated;
66
@@ 263-270 (lines=8) @@
260
        $performanceEvents = $performance->getPerformanceEvents();
261
        $performanceEventsTrans = [];
262
263
        foreach ($performanceEvents as $performanceEvent) {
264
            $performanceEvent->setLocale($paramFetcher->get('locale'));
265
            $em->refresh($performanceEvent);
266
            if ($performanceEvent->getTranslations()) {
267
                $performanceEvent->unsetTranslations();
268
            }
269
            $performanceEventsTrans[] = $performanceEvent;
270
        }
271
        $performanceEvents = $performanceEventsTrans;
272
273
        return $performanceEvents;

src/Controller/Api/PostsController.php 2 locations

@@ 65-72 (lines=8) @@
62
63
            $tags = $post->getTags();
64
65
            foreach ($tags as $tag) {
66
                $tag->setLocale($paramFetcher->get('locale'));
67
                $em->refresh($tag);
68
69
                if ($tag->getTranslations()) {
70
                    $tag->unsetTranslations();
71
                }
72
            }
73
74
            $postsTranslated[] = $post;
75
        }
@@ 173-180 (lines=8) @@
170
171
        $tags = $post->getTags();
172
173
        foreach ($tags as $tag) {
174
            $tag->setLocale($paramFetcher->get('locale'));
175
            $em->refresh($tag);
176
177
            if ($tag->getTranslations()) {
178
                $tag->unsetTranslations();
179
            }
180
        }
181
182
        return $post;
183
    }

src/Controller/Api/SeasonsController.php 1 location

@@ 78-87 (lines=10) @@
75
        $em = $this->getDoctrine()->getManager();
76
        $performancesTranslated = [];
77
78
        foreach ($performances as $performance) {
79
            $performance->setLocale($paramFetcher->get('locale'));
80
            $em->refresh($performance);
81
82
            if ($performance->getTranslations()) {
83
                $performance->unsetTranslations();
84
            }
85
86
            $performancesTranslated[] = $performance;
87
        }
88
89
        return $performancesTranslated;
90
    }