Code Duplication    Length = 11-12 lines in 2 locations

app/Http/Controllers/Admin/PageController.php 2 locations

@@ 134-145 (lines=12) @@
131
        );
132
133
        $devicesGraph = [];
134
        for ($i = 0; $i < 8; $i++) {
135
            $date = Carbon::now()->subMonths($i);
136
137
            $devicesGraph[$date->format('Ym')] = [
138
                'period' => $date->format('Y-m-d'),
139
                'Apple' => 0,
140
                'Samsung' => 0,
141
                'Google' => 0,
142
                'HTC' => 0,
143
                'Microsoft' => 0
144
            ];
145
        }
146
147
        foreach ($devicesData->rows as $device) {
148
            $devicesGraph[$device[1]][$device[0]] = $device[2];
@@ 169-179 (lines=11) @@
166
        );
167
168
        $operatingSystemGraph = [];
169
        for ($i = 0; $i < 8; $i++) {
170
            $date = Carbon::now()->subMonths($i);
171
172
            $operatingSystemGraph[$date->format('Ym')] = [
173
                'period' => $date->format('Y-m-d'),
174
                'Windows' => 0,
175
                'Macintosh' => 0,
176
                'Linux' => 0,
177
                '(not set)' => 0
178
            ];
179
        }
180
181
        foreach ($operatingSystemData->rows as $os) {
182
            $operatingSystemGraph[$os[1]][$os[0]] = $os[2];