Code Duplication    Length = 20-23 lines in 3 locations

src/PhpSpreadsheet/Calculation/MathTrig.php 1 location

@@ 840-862 (lines=23) @@
837
     * @param    mixed        $arg,...        Data values
838
     * @return    float
839
     */
840
    public static function PRODUCT()
841
    {
842
        // Return value
843
        $returnValue = null;
844
845
        // Loop through arguments
846
        foreach (Functions::flattenArray(func_get_args()) as $arg) {
847
            // Is it a numeric value?
848
            if ((is_numeric($arg)) && (!is_string($arg))) {
849
                if (is_null($returnValue)) {
850
                    $returnValue = $arg;
851
                } else {
852
                    $returnValue *= $arg;
853
                }
854
            }
855
        }
856
857
        // Return
858
        if (is_null($returnValue)) {
859
            return 0;
860
        }
861
        return $returnValue;
862
    }
863
864
865
    /**

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2190-2209 (lines=20) @@
2187
     * @param    mixed        $arg,...        Data values
2188
     * @return    float
2189
     */
2190
    public static function MAX()
2191
    {
2192
        $returnValue = null;
2193
2194
        // Loop through arguments
2195
        $aArgs = Functions::flattenArray(func_get_args());
2196
        foreach ($aArgs as $arg) {
2197
            // Is it a numeric value?
2198
            if ((is_numeric($arg)) && (!is_string($arg))) {
2199
                if ((is_null($returnValue)) || ($arg > $returnValue)) {
2200
                    $returnValue = $arg;
2201
                }
2202
            }
2203
        }
2204
2205
        if (is_null($returnValue)) {
2206
            return 0;
2207
        }
2208
        return $returnValue;
2209
    }
2210
2211
2212
    /**
@@ 2349-2368 (lines=20) @@
2346
     * @param    mixed        $arg,...        Data values
2347
     * @return    float
2348
     */
2349
    public static function MIN()
2350
    {
2351
        $returnValue = null;
2352
2353
        // Loop through arguments
2354
        $aArgs = Functions::flattenArray(func_get_args());
2355
        foreach ($aArgs as $arg) {
2356
            // Is it a numeric value?
2357
            if ((is_numeric($arg)) && (!is_string($arg))) {
2358
                if ((is_null($returnValue)) || ($arg < $returnValue)) {
2359
                    $returnValue = $arg;
2360
                }
2361
            }
2362
        }
2363
2364
        if (is_null($returnValue)) {
2365
            return 0;
2366
        }
2367
        return $returnValue;
2368
    }
2369
2370
2371
    /**