Code Duplication    Length = 27-27 lines in 2 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2022-2048 (lines=27) @@
2019
     *
2020
     * @return float
2021
     */
2022
    public static function LARGE(...$args)
2023
    {
2024
        $aArgs = Functions::flattenArray($args);
2025
2026
        // Calculate
2027
        $entry = floor(array_pop($aArgs));
2028
2029
        if ((is_numeric($entry)) && (!is_string($entry))) {
2030
            $mArgs = [];
2031
            foreach ($aArgs as $arg) {
2032
                // Is it a numeric value?
2033
                if ((is_numeric($arg)) && (!is_string($arg))) {
2034
                    $mArgs[] = $arg;
2035
                }
2036
            }
2037
            $count = self::COUNT($mArgs);
2038
            $entry = floor(--$entry);
2039
            if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
2040
                return Functions::NAN();
2041
            }
2042
            rsort($mArgs);
2043
2044
            return $mArgs[$entry];
2045
        }
2046
2047
        return Functions::VALUE();
2048
    }
2049
2050
    /**
2051
     * LINEST.
@@ 3099-3125 (lines=27) @@
3096
     *
3097
     * @return float
3098
     */
3099
    public static function SMALL(...$args)
3100
    {
3101
        $aArgs = Functions::flattenArray($args);
3102
3103
        // Calculate
3104
        $entry = array_pop($aArgs);
3105
3106
        if ((is_numeric($entry)) && (!is_string($entry))) {
3107
            $mArgs = [];
3108
            foreach ($aArgs as $arg) {
3109
                // Is it a numeric value?
3110
                if ((is_numeric($arg)) && (!is_string($arg))) {
3111
                    $mArgs[] = $arg;
3112
                }
3113
            }
3114
            $count = self::COUNT($mArgs);
3115
            $entry = floor(--$entry);
3116
            if (($entry < 0) || ($entry >= $count) || ($count == 0)) {
3117
                return Functions::NAN();
3118
            }
3119
            sort($mArgs);
3120
3121
            return $mArgs[$entry];
3122
        }
3123
3124
        return Functions::VALUE();
3125
    }
3126
3127
    /**
3128
     * STANDARDIZE.