Code Duplication    Length = 8-10 lines in 5 locations

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
    }

src/Controller/Api/PerformancesController.php 2 locations

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