| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 14 | class IsCloseAllowedConditionPlugin implements ConditionInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @api |
||
| 18 | * |
||
| 19 | * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem $orderItem |
||
| 20 | * |
||
| 21 | * @return bool |
||
| 22 | */ |
||
| 23 | public function check(SpySalesOrderItem $orderItem) |
||
| 24 | { |
||
| 25 | foreach ($orderItem->getOrder()->getItems() as $salesOrderItem) { |
||
| 26 | if (!$this->isInCloseAllowedState($salesOrderItem->getState()->getName())) { |
||
| 27 | return false; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | return true; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $state |
||
| 36 | * |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | protected function isInCloseAllowedState($state) |
||
| 48 | } |
||
| 49 | } |
||
| 50 |