Code Duplication    Length = 17-18 lines in 2 locations

src/PhpSpreadsheet/Calculation/DateTime.php 2 locations

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