Total Complexity | 5 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Coverage | 40% |
Changes | 0 |
1 | <?php |
||
11 | class FixedPerTicket implements DiscountTypeInterface |
||
12 | { |
||
13 | /** |
||
14 | * @JMS\Type("Price") |
||
15 | * @var Price |
||
16 | */ |
||
17 | private $discount; |
||
18 | |||
19 | /** |
||
20 | * Percentage constructor. |
||
21 | * @param $discount |
||
22 | */ |
||
23 | 5 | public function __construct(Price $discount) |
|
24 | { |
||
25 | 5 | $this->discount = $discount; |
|
26 | 5 | } |
|
27 | |||
28 | 5 | public function apply(Basket $to): Price |
|
29 | { |
||
30 | 5 | $tickets = count($to->getTickets()); |
|
31 | 5 | return $this->discount->multiply($tickets); |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return Price |
||
36 | */ |
||
37 | public function getDiscount(): Price |
||
40 | } |
||
41 | |||
42 | public static function fromArray(array $data, Configuration $configuration): DiscountTypeInterface |
||
55 |