Code Duplication    Length = 16-19 lines in 2 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 2108-2123 (lines=16) @@
2105
     *            accuracy if I can get my head round the mathematics
2106
     *            (as described at) http://home.online.no/~pjacklam/notes/invnorm/
2107
     */
2108
    public static function LOGINV($probability, $mean, $stdDev)
2109
    {
2110
        $probability = Functions::flattenSingleValue($probability);
2111
        $mean = Functions::flattenSingleValue($mean);
2112
        $stdDev = Functions::flattenSingleValue($stdDev);
2113
2114
        if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
2115
            if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) {
2116
                return Functions::NAN();
2117
            }
2118
2119
            return exp($mean + $stdDev * self::NORMSINV($probability));
2120
        }
2121
2122
        return Functions::VALUE();
2123
    }
2124
2125
    /**
2126
     * LOGNORMDIST
@@ 2574-2592 (lines=19) @@
2571
     * @param    float        $stdDev        Standard Deviation
2572
     * @return    float
2573
     */
2574
    public static function NORMINV($probability, $mean, $stdDev)
2575
    {
2576
        $probability = Functions::flattenSingleValue($probability);
2577
        $mean = Functions::flattenSingleValue($mean);
2578
        $stdDev = Functions::flattenSingleValue($stdDev);
2579
2580
        if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) {
2581
            if (($probability < 0) || ($probability > 1)) {
2582
                return Functions::NAN();
2583
            }
2584
            if ($stdDev < 0) {
2585
                return Functions::NAN();
2586
            }
2587
2588
            return (self::inverseNcdf($probability) * $stdDev) + $mean;
2589
        }
2590
2591
        return Functions::VALUE();
2592
    }
2593
2594
    /**
2595
     * NORMSDIST