Code Duplication    Length = 21-24 lines in 3 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2065-2085 (lines=21) @@
2062
     *
2063
     * @return float
2064
     */
2065
    public static function MAX(...$args)
2066
    {
2067
        $returnValue = null;
2068
2069
        // Loop through arguments
2070
        $aArgs = Functions::flattenArray($args);
2071
        foreach ($aArgs as $arg) {
2072
            // Is it a numeric value?
2073
            if ((is_numeric($arg)) && (!is_string($arg))) {
2074
                if (($returnValue === null) || ($arg > $returnValue)) {
2075
                    $returnValue = $arg;
2076
                }
2077
            }
2078
        }
2079
2080
        if ($returnValue === null) {
2081
            return 0;
2082
        }
2083
2084
        return $returnValue;
2085
    }
2086
2087
    /**
2088
     * MAXA.
@@ 2228-2248 (lines=21) @@
2225
     *
2226
     * @return float
2227
     */
2228
    public static function MIN(...$args)
2229
    {
2230
        $returnValue = null;
2231
2232
        // Loop through arguments
2233
        $aArgs = Functions::flattenArray($args);
2234
        foreach ($aArgs as $arg) {
2235
            // Is it a numeric value?
2236
            if ((is_numeric($arg)) && (!is_string($arg))) {
2237
                if (($returnValue === null) || ($arg < $returnValue)) {
2238
                    $returnValue = $arg;
2239
                }
2240
            }
2241
        }
2242
2243
        if ($returnValue === null) {
2244
            return 0;
2245
        }
2246
2247
        return $returnValue;
2248
    }
2249
2250
    /**
2251
     * MINA.

src/PhpSpreadsheet/Calculation/MathTrig.php 1 location

@@ 806-829 (lines=24) @@
803
     *
804
     * @return float
805
     */
806
    public static function PRODUCT(...$args)
807
    {
808
        // Return value
809
        $returnValue = null;
810
811
        // Loop through arguments
812
        foreach (Functions::flattenArray($args) as $arg) {
813
            // Is it a numeric value?
814
            if ((is_numeric($arg)) && (!is_string($arg))) {
815
                if ($returnValue === null) {
816
                    $returnValue = $arg;
817
                } else {
818
                    $returnValue *= $arg;
819
                }
820
            }
821
        }
822
823
        // Return
824
        if ($returnValue === null) {
825
            return 0;
826
        }
827
828
        return $returnValue;
829
    }
830
831
    /**
832
     * QUOTIENT.