Code Duplication    Length = 12-12 lines in 2 locations

src/Xtools/Page.php 1 location

@@ 114-125 (lines=12) @@
111
        $totalAdded = 0;
112
        $totalRemoved = 0;
113
        $revisions = [];
114
        foreach ($data as $revision) {
115
            if ($revision['length_change'] > 0) {
116
                $totalAdded += $revision['length_change'];
117
            } else {
118
                $totalRemoved += $revision['length_change'];
119
            }
120
            $time = strtotime($revision['timestamp']);
121
            $revision['timestamp'] = $time; // formatted via Twig helper
122
            $revision['year'] = date('Y', $time);
123
            $revision['month'] = date('m', $time);
124
            $revisions[] = $revision;
125
        }
126
        return $revisions;
127
    }
128
}

src/AppBundle/Controller/TopEditsController.php 1 location

@@ 237-248 (lines=12) @@
234
        $totalAdded = 0;
235
        $totalRemoved = 0;
236
        $revisions = [];
237
        foreach ($revisionsData as $revision) {
238
            if ($revision['length_change'] > 0) {
239
                $totalAdded += $revision['length_change'];
240
            } else {
241
                $totalRemoved += $revision['length_change'];
242
            }
243
            $time = strtotime($revision['timestamp']);
244
            $revision['timestamp'] = $time; // formatted via Twig helper
245
            $revision['year'] = date('Y', $time);
246
            $revision['month'] = date('m', $time);
247
            $revisions[] = $revision;
248
        }
249
250
        // Send all to the template.
251
        return $this->render('topedits/result_article.html.twig', [