Code Duplication    Length = 25-25 lines in 2 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2337-2361 (lines=25) @@
2334
     *
2335
     * @return float
2336
     */
2337
    public static function MAXIF($aArgs, $condition, $sumArgs = [])
2338
    {
2339
        $returnValue = null;
2340
2341
        $aArgs = Functions::flattenArray($aArgs);
2342
        $sumArgs = Functions::flattenArray($sumArgs);
2343
        if (empty($sumArgs)) {
2344
            $sumArgs = $aArgs;
2345
        }
2346
        $condition = Functions::ifCondition($condition);
2347
        // Loop through arguments
2348
        foreach ($aArgs as $key => $arg) {
2349
            if (!is_numeric($arg)) {
2350
                $arg = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($arg));
2351
            }
2352
            $testCondition = '=' . $arg . $condition;
2353
            if (\PhpOffice\PhpSpreadsheet\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
2354
                if ((is_null($returnValue)) || ($arg > $returnValue)) {
2355
                    $returnValue = $arg;
2356
                }
2357
            }
2358
        }
2359
2360
        return $returnValue;
2361
    }
2362
2363
    /**
2364
     * MEDIAN.
@@ 2500-2524 (lines=25) @@
2497
     *
2498
     * @return float
2499
     */
2500
    public static function MINIF($aArgs, $condition, $sumArgs = [])
2501
    {
2502
        $returnValue = null;
2503
2504
        $aArgs = Functions::flattenArray($aArgs);
2505
        $sumArgs = Functions::flattenArray($sumArgs);
2506
        if (empty($sumArgs)) {
2507
            $sumArgs = $aArgs;
2508
        }
2509
        $condition = Functions::ifCondition($condition);
2510
        // Loop through arguments
2511
        foreach ($aArgs as $key => $arg) {
2512
            if (!is_numeric($arg)) {
2513
                $arg = \PhpOffice\PhpSpreadsheet\Calculation::wrapResult(strtoupper($arg));
2514
            }
2515
            $testCondition = '=' . $arg . $condition;
2516
            if (\PhpOffice\PhpSpreadsheet\Calculation::getInstance()->_calculateFormulaValue($testCondition)) {
2517
                if ((is_null($returnValue)) || ($arg < $returnValue)) {
2518
                    $returnValue = $arg;
2519
                }
2520
            }
2521
        }
2522
2523
        return $returnValue;
2524
    }
2525
2526
    //
2527
    //    Special variant of array_count_values that isn't limited to strings and integers,