Code Duplication    Length = 14-14 lines in 2 locations

src/Samsara/Fermat/Provider/Distribution/Exponential.php 1 location

@@ 28-41 (lines=14) @@
25
     *
26
     * @throws IntegrityConstraint
27
     */
28
    public function __construct($lambda)
29
    {
30
        $lambda = Numbers::makeOrDont(Numbers::IMMUTABLE, $lambda);
31
32
        if (!$lambda->isPositive()) {
33
            throw new IntegrityConstraint(
34
                'Lambda must be positive',
35
                'Provide a positive lambda',
36
                'Exponential distributions work on time to occurrence; the mean time to occurrence (lambda) must be positive'
37
            );
38
        }
39
40
        $this->lambda = $lambda;
41
    }
42
43
    /**
44
     * @param int|float|DecimalInterface $x

src/Samsara/Fermat/Provider/Distribution/Poisson.php 1 location

@@ 30-43 (lines=14) @@
27
     *
28
     * @throws IntegrityConstraint
29
     */
30
    public function __construct($lambda)
31
    {
32
        $lambda = Numbers::makeOrDont(Numbers::IMMUTABLE, $lambda);
33
34
        if (!$lambda->isPositive()) {
35
            throw new IntegrityConstraint(
36
                'Lambda must be positive',
37
                'Provide a positive lambda',
38
                'Poisson distributions work on time to occurrence; the mean time to occurrence (lambda) must be positive'
39
            );
40
        }
41
42
        $this->lambda = $lambda;
43
    }
44
45
    /**
46
     * @param int|float|DecimalInterface $k