private function getItems(): LineItemCollection
{ return $this->items;
} private function buildSurchargeDefinition(string
$type, float|PriceCollection|string|int
$value, string
$key): PriceDefinitionInterface
{ if ($type === PercentagePriceDefinition::TYPE
) { if ($value instanceof PriceCollection
) { throw CartException::
invalidPercentageSurcharge($key);
} $value = FloatComparator::
cast((float) $value);
return new PercentagePriceDefinition(abs($value));
} if ($type !== AbsolutePriceDefinition::TYPE
) { throw CartException::
surchargeTypeNotSupported($key,
$type);
} if (!
$value instanceof PriceCollection
) { throw CartException::
absoluteSurchargeMissingPriceCollection($key);
}