private function calculatePrice(float
$price, float
$taxRate, int
$quantity, string
$output, bool
$preCalculated): array
{ $calculator =
$this->grossCalculator;
if ($output === 'net'
) { $calculator =
$this->netCalculator;
} $taxRules =
new TaxRuleCollection([new TaxRule($taxRate)]);
$definition =
new QuantityPriceDefinition($price,
$taxRules,
$quantity);
$definition->
setIsCalculated($preCalculated);
$config =
new CashRoundingConfig(50, 0.01, true
);
$calculated =
$calculator->
calculate($definition,
$config);
return json_decode((string) json_encode($calculated, \JSON_PRESERVE_ZERO_FRACTION
), true, 512, \JSON_THROW_ON_ERROR
);
}}