Code Duplication    Length = 17-18 lines in 2 locations

src/PhpSpreadsheet/Calculation/DateTime.php 2 locations

@@ 1292-1309 (lines=18) @@
1289
     *                                    PHP DateTime object, or a standard date string
1290
     * @return    int        Month of the year
1291
     */
1292
    public static function MONTHOFYEAR($dateValue = 1)
1293
    {
1294
        $dateValue    = Functions::flattenSingleValue($dateValue);
1295
1296
        if (empty($dateValue)) {
1297
            $dateValue = 1;
1298
        }
1299
        if (is_string($dateValue = self::getDateValue($dateValue))) {
1300
            return Functions::VALUE();
1301
        } elseif ($dateValue < 0.0) {
1302
            return Functions::NAN();
1303
        }
1304
1305
        // Execute function
1306
        $PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
1307
1308
        return (int) $PHPDateObject->format('n');
1309
    }
1310
1311
1312
    /**
@@ 1325-1341 (lines=17) @@
1322
     *                                    PHP DateTime object, or a standard date string
1323
     * @return    int        Year
1324
     */
1325
    public static function YEAR($dateValue = 1)
1326
    {
1327
        $dateValue    = Functions::flattenSingleValue($dateValue);
1328
1329
        if ($dateValue === null) {
1330
            $dateValue = 1;
1331
        } elseif (is_string($dateValue = self::getDateValue($dateValue))) {
1332
            return Functions::VALUE();
1333
        } elseif ($dateValue < 0.0) {
1334
            return Functions::NAN();
1335
        }
1336
1337
        // Execute function
1338
        $PHPDateObject = \PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue);
1339
1340
        return (int) $PHPDateObject->format('Y');
1341
    }
1342
1343
1344
    /**