Code Duplication    Length = 21-24 lines in 3 locations

src/PhpSpreadsheet/Calculation/MathTrig.php 1 location

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

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

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