Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
44 | public function createForOrder(OrderInterface $order) |
||
45 | { |
||
46 | if ($order->hasShipments()) { |
||
47 | $shipment = $order->getShipments()->first(); |
||
48 | } else { |
||
49 | $shipment = $this->shipmentFactory->createNew(); |
||
50 | $order->addShipment($shipment); |
||
51 | } |
||
52 | |||
53 | foreach ($order->getInventoryUnits() as $inventoryUnit) { |
||
54 | if (null === $inventoryUnit->getShipment()) { |
||
55 | $shipment->addItem($inventoryUnit); |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 |