CouponAbstract::getCouponSheet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace Germania\Coupons;
3
4
class CouponAbstract implements CouponInterface
5
{
6
7
    /**
8
     * @var string
9
     */
10
    public $code;
11
12
    /**
13
     * @var CouponSheetInterface
14
     */
15
    public $coupon_sheet;
16
17
18
    /**
19
     * @return string
20
     * @implements CouponInterface
21
     */
22 15
    public function getCode()
23
    {
24 15
        return $this->code;
25
    }
26
27
28
    /**
29
     * @return CouponSheetInterface
30
     * @implements CouponInterface
31
     */
32 35
    public function getCouponSheet()
33
    {
34 35
        return $this->coupon_sheet;
35
    }
36
37
    /**
38
     * @return bool
39
     * @implements ValidCouponInterface
40
     */
41 10
    public function isValid()
42
    {
43 10
        $sheet = $this->getCouponSheet();
44 10
        return $sheet and $sheet->isValid();
45
    }
46
47
48
    /**
49
     * @return bool
50
     * @implements ValidCouponInterface
51
     */
52 10
    public function isExpired()
53
    {
54 10
        $sheet = $this->getCouponSheet();
55 10
        return $sheet and $sheet->isExpired();
56
    }
57
58
59
}
60