Code Duplication    Length = 8-8 lines in 2 locations

src/Controller/Endpoint/Alerts/AlertCountsEndpointController.php 2 locations

@@ 115-122 (lines=8) @@
112
        $metrics = $this->getDailyMetrics($servers, $zones, $dates);
113
        $fractal = $this->getContainer()->get('FractalUtility');
114
115
        foreach ($metrics as $row) {
116
            $date = $row['dateIndex'];
117
            unset($row['dateIndex']);
118
            $row['total'] = array_sum($row);
119
120
            // Build each section of the final response using the transformer
121
            $data['data'][$date] = $fractal->createItem($row, new AlertTotalTransformer);
122
        }
123
124
        // Return the now formatted array to the response
125
        return $this->respondWithData($data);
@@ 150-157 (lines=8) @@
147
        foreach ($serversExploded as $server) {
148
            $metrics = $this->getDailyMetrics($server, $zones, $dates);
149
150
            foreach ($metrics as $row) {
151
                $date = $row['dateIndex'];
152
                unset($row['dateIndex']);
153
                $row['total'] = array_sum($row);
154
155
                // Build each section of the final response using the transformer
156
                $data['data'][$server][$date] = $fractal->createItem($row, new AlertTotalTransformer);
157
            }
158
        }
159
160
        // Return the now formatted array to the response