Code Duplication    Length = 27-27 lines in 2 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

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