Code Duplication    Length = 8-8 lines in 2 locations

src/Plugin/Temporal/Aggregator.php 2 locations

@@ 201-208 (lines=8) @@
198
            ksort($timeaxis);
199
200
            $nextSliceId = null;
201
            foreach (array_reverse(array_keys($timeaxis)) as $timestamp) {
202
                if ($nextSliceId) {
203
                    $timeaxis[$timestamp]->end = $nextSliceId;
204
                } else {
205
                    $timeaxis[$timestamp]->end = 0;
206
                }
207
                $nextSliceId = $timestamp;
208
            }
209
210
            $states = [];
211
            foreach ($timeaxis as $state) {
@@ 314-321 (lines=8) @@
311
        ksort($slices);
312
313
        $nextSliceId = null;
314
        foreach (array_reverse(array_keys($slices)) as $timestamp) {
315
            if ($nextSliceId) {
316
                $slices[$timestamp]->end = $nextSliceId;
317
            } else {
318
                $slices[$timestamp]->end = 0;
319
            }
320
            $nextSliceId = $timestamp;
321
        }
322
323
        // calculate states
324
        $states = [];