Code Duplication    Length = 19-19 lines in 2 locations

src/PhpSpreadsheet/Calculation/Statistical.php 2 locations

@@ 1759-1777 (lines=19) @@
1756
     * @param    bool                A logical value specifying whether to force the intersect to equal 0.
1757
     * @return    array of float
1758
     */
1759
    public static function GROWTH($yValues, $xValues = [], $newValues = [], $const = true)
1760
    {
1761
        $yValues = Functions::flattenArray($yValues);
1762
        $xValues = Functions::flattenArray($xValues);
1763
        $newValues = Functions::flattenArray($newValues);
1764
        $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
1765
1766
        $bestFitExponential = \PhpSpreadsheet\Shared\trend\trend::calculate(\PhpSpreadsheet\Shared\trend\trend::TREND_EXPONENTIAL, $yValues, $xValues, $const);
1767
        if (empty($newValues)) {
1768
            $newValues = $bestFitExponential->getXValues();
1769
        }
1770
1771
        $returnArray = [];
1772
        foreach ($newValues as $xValue) {
1773
            $returnArray[0][] = $bestFitExponential->getValueOfYForX($xValue);
1774
        }
1775
1776
        return $returnArray;
1777
    }
1778
1779
    /**
1780
     * HARMEAN
@@ 3375-3393 (lines=19) @@
3372
     * @param    bool                A logical value specifying whether to force the intersect to equal 0.
3373
     * @return    array of float
3374
     */
3375
    public static function TREND($yValues, $xValues = [], $newValues = [], $const = true)
3376
    {
3377
        $yValues = Functions::flattenArray($yValues);
3378
        $xValues = Functions::flattenArray($xValues);
3379
        $newValues = Functions::flattenArray($newValues);
3380
        $const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
3381
3382
        $bestFitLinear = \PhpSpreadsheet\Shared\trend\trend::calculate(\PhpSpreadsheet\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues, $const);
3383
        if (empty($newValues)) {
3384
            $newValues = $bestFitLinear->getXValues();
3385
        }
3386
3387
        $returnArray = [];
3388
        foreach ($newValues as $xValue) {
3389
            $returnArray[0][] = $bestFitLinear->getValueOfYForX($xValue);
3390
        }
3391
3392
        return $returnArray;
3393
    }
3394
3395
    /**
3396
     * TRIMMEAN