Code Duplication    Length = 8-8 lines in 2 locations

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

@@ 123-130 (lines=8) @@
120
121
        $metrics = $this->getDailyMetrics($servers, $zones);
122
123
        foreach ($metrics as $row) {
124
            $date = $row['dateIndex'];
125
            unset($row['dateIndex']);
126
            $row['total'] = array_sum($row);
127
128
            // Build each section of the final response using the transformer
129
            $data['data'][$date] = $this->createItem($row, new AlertTotalTransformer);
130
        }
131
132
        // Return the now formatted array to the response
133
        return $this->respondWithArray($response, $data);
@@ 159-166 (lines=8) @@
156
        foreach ($serversExploded as $server) {
157
            $metrics = $this->getDailyMetrics($server, $zones);
158
159
            foreach ($metrics as $row) {
160
                $date = $row['dateIndex'];
161
                unset($row['dateIndex']);
162
                $row['total'] = array_sum($row);
163
164
                // Build each section of the final response using the transformer
165
                $data['data'][$server][$date] = $this->createItem($row, new AlertTotalTransformer);
166
            }
167
        }
168
169
        // Return the now formatted array to the response