Code Duplication    Length = 11-12 lines in 2 locations

app/Http/Components/AnalyticsComponent.php 2 locations

@@ 172-183 (lines=12) @@
169
        );
170
171
        $devicesGraph = [];
172
        for ($i = 0; $i < 8; $i++) {
173
            $date = Carbon::now()->subMonths($i);
174
175
            $devicesGraph[$date->format('Ym')] = [
176
                'period' => $date->format('Y-m-d'),
177
                'Apple' => 0,
178
                'Samsung' => 0,
179
                'Google' => 0,
180
                'HTC' => 0,
181
                'Microsoft' => 0
182
            ];
183
        }
184
185
        foreach ($devicesData->rows as $device) {
186
            $devicesGraph[$device[1]][$device[0]] = $device[2];
@@ 219-229 (lines=11) @@
216
        );
217
218
        $operatingSystemGraph = [];
219
        for ($i = 0; $i < 8; $i++) {
220
            $date = Carbon::now()->subMonths($i);
221
222
            $operatingSystemGraph[$date->format('Ym')] = [
223
                'period' => $date->format('Y-m-d'),
224
                'Windows' => 0,
225
                'Macintosh' => 0,
226
                'Linux' => 0,
227
                '(not set)' => 0
228
            ];
229
        }
230
231
        foreach ($operatingSystemData->rows as $os) {
232
            $operatingSystemGraph[$os[1]][$os[0]] = $os[2];