| Conditions | 6 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function isEligible(PromotionSubjectInterface $subject, array $configuration) |
||
| 31 | { |
||
| 32 | if (!isset($configuration['taxons'])) { |
||
| 33 | return; |
||
| 34 | } |
||
| 35 | |||
| 36 | if (!$subject instanceof OrderInterface) { |
||
| 37 | throw new UnsupportedTypeException($subject, OrderInterface::class); |
||
| 38 | } |
||
| 39 | |||
| 40 | /* @var $item OrderItemInterface */ |
||
| 41 | foreach ($subject->getItems() as $item) { |
||
| 42 | foreach ($item->getProduct()->getTaxons() as $taxon) { |
||
| 43 | if (in_array($taxon->getCode(), $configuration['taxons'], true)) { |
||
| 44 | return true; |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | return false; |
||
| 50 | } |
||
| 51 | |||
| 60 |