Code Duplication    Length = 21-24 lines in 3 locations

src/PhpSpreadsheet/Calculation/MathTrig.php 1 location

@@ 862-885 (lines=24) @@
859
     *
860
     * @return    float
861
     */
862
    public static function PRODUCT()
863
    {
864
        // Return value
865
        $returnValue = null;
866
867
        // Loop through arguments
868
        foreach (Functions::flattenArray(func_get_args()) as $arg) {
869
            // Is it a numeric value?
870
            if ((is_numeric($arg)) && (!is_string($arg))) {
871
                if (is_null($returnValue)) {
872
                    $returnValue = $arg;
873
                } else {
874
                    $returnValue *= $arg;
875
                }
876
            }
877
        }
878
879
        // Return
880
        if (is_null($returnValue)) {
881
            return 0;
882
        }
883
884
        return $returnValue;
885
    }
886
887
    /**
888
     * QUOTIENT.

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2260-2280 (lines=21) @@
2257
     *
2258
     * @return    float
2259
     */
2260
    public static function MAX()
2261
    {
2262
        $returnValue = null;
2263
2264
        // Loop through arguments
2265
        $aArgs = Functions::flattenArray(func_get_args());
2266
        foreach ($aArgs as $arg) {
2267
            // Is it a numeric value?
2268
            if ((is_numeric($arg)) && (!is_string($arg))) {
2269
                if ((is_null($returnValue)) || ($arg > $returnValue)) {
2270
                    $returnValue = $arg;
2271
                }
2272
            }
2273
        }
2274
2275
        if (is_null($returnValue)) {
2276
            return 0;
2277
        }
2278
2279
        return $returnValue;
2280
    }
2281
2282
    /**
2283
     * MAXA.
@@ 2424-2444 (lines=21) @@
2421
     *
2422
     * @return    float
2423
     */
2424
    public static function MIN()
2425
    {
2426
        $returnValue = null;
2427
2428
        // Loop through arguments
2429
        $aArgs = Functions::flattenArray(func_get_args());
2430
        foreach ($aArgs as $arg) {
2431
            // Is it a numeric value?
2432
            if ((is_numeric($arg)) && (!is_string($arg))) {
2433
                if ((is_null($returnValue)) || ($arg < $returnValue)) {
2434
                    $returnValue = $arg;
2435
                }
2436
            }
2437
        }
2438
2439
        if (is_null($returnValue)) {
2440
            return 0;
2441
        }
2442
2443
        return $returnValue;
2444
    }
2445
2446
    /**
2447
     * MINA.