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(...$args)
863
    {
864
        // Return value
865
        $returnValue = null;
866
867
        // Loop through arguments
868
        foreach (Functions::flattenArray($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

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