Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function isEligible(PromotionSubjectInterface $subject, array $configuration) |
||
30 | { |
||
31 | if (!$subject instanceof OrderInterface) { |
||
32 | throw new UnsupportedTypeException($subject, OrderInterface::class); |
||
33 | } |
||
34 | |||
35 | if (null === $customer = $subject->getCustomer()) { |
||
36 | return false; |
||
37 | } |
||
38 | |||
39 | if (!$customer instanceof CustomerInterface) { |
||
40 | return false; |
||
41 | } |
||
42 | |||
43 | if (null === $customer->getGroup()) { |
||
44 | return false; |
||
45 | } |
||
46 | |||
47 | return $configuration['group_code'] === $customer->getGroup()->getCode(); |
||
48 | } |
||
49 | |||
58 |