Code Duplication    Length = 20-23 lines in 3 locations

src/PhpSpreadsheet/Calculation/MathTrig.php 1 location

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

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2169-2188 (lines=20) @@
2166
     * @param    mixed        $arg,...        Data values
2167
     * @return    float
2168
     */
2169
    public static function MAX()
2170
    {
2171
        $returnValue = null;
2172
2173
        // Loop through arguments
2174
        $aArgs = Functions::flattenArray(func_get_args());
2175
        foreach ($aArgs as $arg) {
2176
            // Is it a numeric value?
2177
            if ((is_numeric($arg)) && (!is_string($arg))) {
2178
                if ((is_null($returnValue)) || ($arg > $returnValue)) {
2179
                    $returnValue = $arg;
2180
                }
2181
            }
2182
        }
2183
2184
        if (is_null($returnValue)) {
2185
            return 0;
2186
        }
2187
2188
        return $returnValue;
2189
    }
2190
2191
    /**
@@ 2323-2342 (lines=20) @@
2320
     * @param    mixed        $arg,...        Data values
2321
     * @return    float
2322
     */
2323
    public static function MIN()
2324
    {
2325
        $returnValue = null;
2326
2327
        // Loop through arguments
2328
        $aArgs = Functions::flattenArray(func_get_args());
2329
        foreach ($aArgs as $arg) {
2330
            // Is it a numeric value?
2331
            if ((is_numeric($arg)) && (!is_string($arg))) {
2332
                if ((is_null($returnValue)) || ($arg < $returnValue)) {
2333
                    $returnValue = $arg;
2334
                }
2335
            }
2336
        }
2337
2338
        if (is_null($returnValue)) {
2339
            return 0;
2340
        }
2341
2342
        return $returnValue;
2343
    }
2344
2345
    /**