Code Duplication    Length = 25-25 lines in 2 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 1947-1971 (lines=25) @@
1944
     * @param    int            $entry            Position (ordered from the largest) in the array or range of data to return
1945
     * @return    float
1946
     */
1947
    public static function LARGE()
1948
    {
1949
        $aArgs = Functions::flattenArray(func_get_args());
1950
1951
        // Calculate
1952
        $entry = floor(array_pop($aArgs));
1953
1954
        if ((is_numeric($entry)) && (!is_string($entry))) {
1955
            $mArgs = [];
1956
            foreach ($aArgs as $arg) {
1957
                // Is it a numeric value?
1958
                if ((is_numeric($arg)) && (!is_string($arg))) {
1959
                    $mArgs[] = $arg;
1960
                }
1961
            }
1962
            $count = self::COUNT($mArgs);
1963
            $entry = floor(--$entry);
1964
            if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
1965
                return Functions::NAN();
1966
            }
1967
            rsort($mArgs);
1968
1969
            return $mArgs[$entry];
1970
        }
1971
1972
        return Functions::VALUE();
1973
    }
1974
@@ 2967-2991 (lines=25) @@
2964
     * @param    int            $entry            Position (ordered from the smallest) in the array or range of data to return
2965
     * @return    float
2966
     */
2967
    public static function SMALL()
2968
    {
2969
        $aArgs = Functions::flattenArray(func_get_args());
2970
2971
        // Calculate
2972
        $entry = array_pop($aArgs);
2973
2974
        if ((is_numeric($entry)) && (!is_string($entry))) {
2975
            $mArgs = [];
2976
            foreach ($aArgs as $arg) {
2977
                // Is it a numeric value?
2978
                if ((is_numeric($arg)) && (!is_string($arg))) {
2979
                    $mArgs[] = $arg;
2980
                }
2981
            }
2982
            $count = self::COUNT($mArgs);
2983
            $entry = floor(--$entry);
2984
            if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
2985
                return Functions::NAN();
2986
            }
2987
            sort($mArgs);
2988
2989
            return $mArgs[$entry];
2990
        }
2991
2992
        return Functions::VALUE();
2993
    }
2994