| Total Complexity | 5 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Coverage | 69.23% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class DiscountCode |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @JMS\Type("string") |
||
| 18 | * @ORM\Column(type="string") |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $code; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @JMS\Type("string") |
||
| 25 | * @ORM\Column(type="string") |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | private $displayName; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @JMS\Type("Object") |
||
| 32 | * @ORM\Column(type="json_object") |
||
| 33 | * @var DiscountTypeInterface |
||
| 34 | */ |
||
| 35 | private $discountType; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * DiscountCode constructor. |
||
| 39 | * @param $code |
||
| 40 | * @param $displayName |
||
| 41 | * @param $discountType |
||
| 42 | */ |
||
| 43 | 5 | public function __construct(string $code, string $displayName, DiscountTypeInterface $discountType) |
|
| 44 | { |
||
| 45 | 5 | $this->code = $code; |
|
| 46 | 5 | $this->displayName = $displayName; |
|
| 47 | 5 | $this->discountType = $discountType; |
|
| 48 | 5 | } |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | 5 | public function getCode(): string |
|
| 54 | { |
||
| 55 | 5 | return $this->code; |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return string |
||
| 60 | */ |
||
| 61 | public function getDisplayName(): string |
||
| 62 | { |
||
| 63 | return $this->displayName; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @return DiscountTypeInterface |
||
| 68 | */ |
||
| 69 | public function getDiscountType(): DiscountTypeInterface |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @param Basket $to |
||
| 76 | * @return Price |
||
| 77 | */ |
||
| 78 | 4 | public function apply(Basket $to): Price |
|
| 81 | } |
||
| 82 | } |