Code Duplication    Length = 17-18 lines in 2 locations

src/PhpSpreadsheet/Calculation/DateTime.php 2 locations

@@ 1303-1320 (lines=18) @@
1300
     *
1301
     * @return int Month of the year
1302
     */
1303
    public static function MONTHOFYEAR($dateValue = 1)
1304
    {
1305
        $dateValue = Functions::flattenSingleValue($dateValue);
1306
1307
        if (empty($dateValue)) {
1308
            $dateValue = 1;
1309
        }
1310
        if (is_string($dateValue = self::getDateValue($dateValue))) {
1311
            return Functions::VALUE();
1312
        } elseif ($dateValue < 0.0) {
1313
            return Functions::NAN();
1314
        }
1315
1316
        // Execute function
1317
        $PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
1318
1319
        return (int) $PHPDateObject->format('n');
1320
    }
1321
1322
    /**
1323
     * YEAR.
@@ 1336-1352 (lines=17) @@
1333
     *
1334
     * @return int Year
1335
     */
1336
    public static function YEAR($dateValue = 1)
1337
    {
1338
        $dateValue = Functions::flattenSingleValue($dateValue);
1339
1340
        if ($dateValue === null) {
1341
            $dateValue = 1;
1342
        } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
1343
            return Functions::VALUE();
1344
        } elseif ($dateValue < 0.0) {
1345
            return Functions::NAN();
1346
        }
1347
1348
        // Execute function
1349
        $PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
1350
1351
        return (int) $PHPDateObject->format('Y');
1352
    }
1353
1354
    /**
1355
     * HOUROFDAY.