Code Duplication    Length = 16-19 lines in 2 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2199-2214 (lines=16) @@
2196
     *            accuracy if I can get my head round the mathematics
2197
     *            (as described at) http://home.online.no/~pjacklam/notes/invnorm/
2198
     */
2199
    public static function LOGINV($probability, $mean, $stdDev)
2200
    {
2201
        $probability = Functions::flattenSingleValue($probability);
2202
        $mean = Functions::flattenSingleValue($mean);
2203
        $stdDev = Functions::flattenSingleValue($stdDev);
2204
2205
        if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
2206
            if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) {
2207
                return Functions::NAN();
2208
            }
2209
2210
            return exp($mean + $stdDev * self::NORMSINV($probability));
2211
        }
2212
2213
        return Functions::VALUE();
2214
    }
2215
2216
    /**
2217
     * LOGNORMDIST.
@@ 2689-2707 (lines=19) @@
2686
     *
2687
     * @return    float
2688
     */
2689
    public static function NORMINV($probability, $mean, $stdDev)
2690
    {
2691
        $probability = Functions::flattenSingleValue($probability);
2692
        $mean = Functions::flattenSingleValue($mean);
2693
        $stdDev = Functions::flattenSingleValue($stdDev);
2694
2695
        if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
2696
            if (($probability < 0) || ($probability > 1)) {
2697
                return Functions::NAN();
2698
            }
2699
            if ($stdDev < 0) {
2700
                return Functions::NAN();
2701
            }
2702
2703
            return (self::inverseNcdf($probability) * $stdDev) + $mean;
2704
        }
2705
2706
        return Functions::VALUE();
2707
    }
2708
2709
    /**
2710
     * NORMSDIST.