Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function purify(OrderInterface $order): void |
||
29 | { |
||
30 | /** @var Collection $shipments */ |
||
31 | $shipments = $order->getShipments(); |
||
32 | $shipmentsToRemove = $shipments->filter(static function (ShipmentInterface $shipment): bool { |
||
33 | return $shipment->getState() === ShipmentInterface::STATE_READY && $shipment->getUnits()->isEmpty(); |
||
34 | }); |
||
35 | |||
36 | if (count($shipmentsToRemove) === 0) { |
||
37 | return; |
||
38 | } |
||
39 | |||
40 | foreach ($shipmentsToRemove as $shipmentToRemove) { |
||
41 | $order->removeShipment($shipmentToRemove); |
||
42 | } |
||
43 | |||
44 | $this->molliePartialShip->partialShip($order); |
||
45 | } |
||
47 |