use Shopware\Core\Checkout\Cart\Tax\Struct\TaxRuleCollection;
use Shopware\Core\Checkout\Shipping\ShippingException;
use Shopware\Core\Checkout\Shipping\ShippingMethodEntity;
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);
}