// if the line item has a restock time, add this days to the restock date
if ($restockTime) { $restockDate =
$restockDate->
add(new \
DateInterval('P' .
$restockTime . 'D'
));
} if ($item->
getPrice() === null
) { continue;
} // if the item is completely in stock, use the delivery date
if ($item->
getDeliveryInformation()->
getStock() >=
$item->
getQuantity()) { $position =
new DeliveryPosition($item->
getId(),
clone $item,
$item->
getQuantity(),
clone $item->
getPrice(),
$deliveryDate);
} else { // otherwise use the restock date as delivery date
$position =
new DeliveryPosition($item->
getId(),
clone $item,
$item->
getQuantity(),
clone $item->
getPrice(),
$restockDate);
} $positions->
add($position);
} }}