public static function calculate($base, TaxRateInterface $rate) { if ($rate->isIncludedInPrice()) { return $base - $base / (1 + $rate->getAmount()); } return $base * $rate->getAmount(); }
public function transform(TaxRateInterface $taxRate) { return array('id' => $taxRate->id, 'category' => $taxRate->category, 'amount' => $taxRate->getAmount(), 'percentage' => $taxRate->getAmountAsPercentage(), 'included_in_price' => (bool) $taxRate->isIncludedInPrice()); }