Code Duplication    Length = 4-6 lines in 2 locations

models/types/Agenda.php 2 locations

@@ 227-230 (lines=4) @@
224
            // Apply it to all events on this line
225
            foreach ($events as $k => $e) {
226
                if ($e['start'] < $i && $i < $e['end']) {
227
                    if ($e['overlaps'] < $maxOverlaps) {
228
                        $e['overlaps'] = $maxOverlaps;
229
                        $events[$k] = $e;
230
                    }
231
                }
232
            }
233
        }
@@ 268-273 (lines=6) @@
265
    private function positionBlocks($events)
266
    {
267
        foreach ($events as $k => $e) {
268
            if ($e['overlaps'] < 2) {
269
                // No overlap, easy mode
270
                $e['position'] = 0;
271
                $events[$k] = $e;
272
                continue;
273
            }
274
275
            if (array_key_exists('position', $e)) {
276
                // Position already set, don't touch