use Shopware\Core\Framework\Log\Package;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
#[Package('checkout')]
class DeliveryBuilder{ public function build(Cart
$cart, CartDataCollection
$data, SalesChannelContext
$context, CartBehavior
$cartBehavior): DeliveryCollection
{ $key = DeliveryProcessor::
buildKey($context->
getShippingMethod()->
getId());
if (!
$data->
has($key)) { throw ShippingException::
shippingMethodNotFound($context->
getShippingMethod()->
getId());
} /** @var ShippingMethodEntity $shippingMethod */
$shippingMethod =
$data->
get($key);
return $this->
buildByUsingShippingMethod($cart,
$shippingMethod,
$context);
} public function buildByUsingShippingMethod(Cart
$cart, ShippingMethodEntity
$shippingMethod, SalesChannelContext
$context): DeliveryCollection
{ $delivery =
$this->
buildSingleDelivery($shippingMethod,
$cart->
getLineItems(),
$context);