CouponAbstract   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 56
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCode() 0 4 1
A getCouponSheet() 0 4 1
A isValid() 0 5 2
A isExpired() 0 5 2
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