Code Duplication    Length = 10-10 lines in 3 locations

src/PhpSpreadsheet/Calculation/DateTime.php 3 locations

@@ 398-407 (lines=10) @@
395
        $minute = (integer) $minute;
396
        $second = (integer) $second;
397
398
        if ($second < 0) {
399
            $minute += floor($second / 60);
400
            $second = 60 - abs($second % 60);
401
            if ($second == 60) {
402
                $second = 0;
403
            }
404
        } elseif ($second >= 60) {
405
            $minute += floor($second / 60);
406
            $second = $second % 60;
407
        }
408
        if ($minute < 0) {
409
            $hour += floor($minute / 60);
410
            $minute = 60 - abs($minute % 60);
@@ 408-417 (lines=10) @@
405
            $minute += floor($second / 60);
406
            $second = $second % 60;
407
        }
408
        if ($minute < 0) {
409
            $hour += floor($minute / 60);
410
            $minute = 60 - abs($minute % 60);
411
            if ($minute == 60) {
412
                $minute = 0;
413
            }
414
        } elseif ($minute >= 60) {
415
            $hour += floor($minute / 60);
416
            $minute = $minute % 60;
417
        }
418
419
        if ($hour > 23) {
420
            $hour = $hour % 24;
@@ 438-447 (lines=10) @@
435
                return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second));    // -2147468400; //    -2147472000 + 3600
436
            case Functions::RETURNDATE_PHP_OBJECT:
437
                $dayAdjust = 0;
438
                if ($hour < 0) {
439
                    $dayAdjust = floor($hour / 24);
440
                    $hour = 24 - abs($hour % 24);
441
                    if ($hour == 24) {
442
                        $hour = 0;
443
                    }
444
                } elseif ($hour >= 24) {
445
                    $dayAdjust = floor($hour / 24);
446
                    $hour = $hour % 24;
447
                }
448
                $phpDateObject = new \DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second);
449
                if ($dayAdjust != 0) {
450
                    $phpDateObject->modify($dayAdjust.' days');