Code Duplication    Length = 10-10 lines in 3 locations

src/PhpSpreadsheet/Calculation/DateTime.php 3 locations

@@ 389-398 (lines=10) @@
386
        $minute = (integer) $minute;
387
        $second = (integer) $second;
388
389
        if ($second < 0) {
390
            $minute += floor($second / 60);
391
            $second = 60 - abs($second % 60);
392
            if ($second == 60) {
393
                $second = 0;
394
            }
395
        } elseif ($second >= 60) {
396
            $minute += floor($second / 60);
397
            $second = $second % 60;
398
        }
399
        if ($minute < 0) {
400
            $hour += floor($minute / 60);
401
            $minute = 60 - abs($minute % 60);
@@ 399-408 (lines=10) @@
396
            $minute += floor($second / 60);
397
            $second = $second % 60;
398
        }
399
        if ($minute < 0) {
400
            $hour += floor($minute / 60);
401
            $minute = 60 - abs($minute % 60);
402
            if ($minute == 60) {
403
                $minute = 0;
404
            }
405
        } elseif ($minute >= 60) {
406
            $hour += floor($minute / 60);
407
            $minute = $minute % 60;
408
        }
409
410
        if ($hour > 23) {
411
            $hour = $hour % 24;
@@ 430-439 (lines=10) @@
427
                return (integer) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; //    -2147472000 + 3600
428
            case Functions::RETURNDATE_PHP_OBJECT:
429
                $dayAdjust = 0;
430
                if ($hour < 0) {
431
                    $dayAdjust = floor($hour / 24);
432
                    $hour = 24 - abs($hour % 24);
433
                    if ($hour == 24) {
434
                        $hour = 0;
435
                    }
436
                } elseif ($hour >= 24) {
437
                    $dayAdjust = floor($hour / 24);
438
                    $hour = $hour % 24;
439
                }
440
                $phpDateObject = new \DateTime('1900-01-01 ' . $hour . ':' . $minute . ':' . $second);
441
                if ($dayAdjust != 0) {
442
                    $phpDateObject->modify($dayAdjust . ' days');