if ($definition instanceof PercentagePriceDefinition
) { // reduce line items for provided filter
$prices =
$this->
filterLineItems($calculated,
$definition->
getFilter(),
$context) ->
getPrices();
return $this->percentagePriceCalculator->
calculate($definition->
getPercentage(),
$prices,
$context);
} if ($definition instanceof QuantityPriceDefinition
) { $definition->
setQuantity($lineItem->
getQuantity());
return $this->quantityPriceCalculator->
calculate($definition,
$context);
} throw CartException::
missingLineItemPrice($lineItem->
getId());
}}