Code Duplication    Length = 14-18 lines in 2 locations

src/Checkers/CouponEligibilityChecker.php 1 location

@@ 51-64 (lines=14) @@
48
     *
49
     * @return bool
50
     */
51
    public function isEligible(DiscountSubjectContract $subject, Coupon $coupon)
52
    {
53
        if (!$this->datesEligibilityChecker->isEligible($coupon)) {
54
            return false;
55
        }
56
57
        $eligible = $this->rulesEligibilityChecker->isEligible($subject, $coupon->discount);
58
59
        if (!$eligible) {
60
            return false;
61
        }
62
63
        return $eligible;
64
    }
65
}
66

src/Checkers/DiscountEligibilityChecker.php 1 location

@@ 35-52 (lines=18) @@
32
        $this->rulesEligibilityChecker = $rulesEligibilityChecker;
33
    }
34
35
    public function isEligible(DiscountSubjectContract $subject, DiscountContract $discount)
36
    {
37
        if (!$this->datesEligibilityChecker->isEligible($discount)) {
38
            return false;
39
        }
40
41
        if (!$this->usageLimitEligibilityChecker->isEligible($discount)) {
42
            return false;
43
        }
44
45
        $eligible = $this->rulesEligibilityChecker->isEligible($subject, $discount);
46
47
        if (!$eligible) {
48
            return false;
49
        }
50
51
        return $eligible;
52
    }
53
}
54