Conditions | 5 |
Paths | 5 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function isEligible(PromotionSubjectInterface $subject, array $configuration) |
||
31 | { |
||
32 | if (!$subject instanceof OrderInterface) { |
||
33 | throw new UnsupportedTypeException($subject, OrderInterface::class); |
||
34 | } |
||
35 | |||
36 | /* @var $item OrderItemInterface */ |
||
37 | foreach ($subject->getItems() as $item) { |
||
38 | foreach ($item->getProduct()->getTaxons() as $taxon) { |
||
39 | if ($configuration['taxons']->contains($taxon->getId())) { |
||
40 | return !$configuration['exclude']; |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | |||
45 | return (Boolean) $configuration['exclude']; |
||
46 | } |
||
47 | |||
56 |