/** * returns the tax rule value * * @param string $country * @param bool $company * * @return int|null|mixed */ private function getTaxRuleValue($country, $company) { if (!$this->ruleSet->hasRule($country)) { return 0; } if ($company && $country !== $this->country) { return 0; } return $this->ruleSet->getRuleValue($country); }
public static function getCalculator($ownCountry = 'DE') { $rules = new RuleSet(); $rules->addRule(new Rule('AT', 0.2)); $rules->addRule(new Rule('BE', 0.21)); $rules->addRule(new Rule('BG', 0.2)); $rules->addRule(new Rule('CY', 0.19)); $rules->addRule(new Rule('CZ', 0.21)); $rules->addRule(new Rule('DE', 0.19)); $rules->addRule(new Rule('DK', 0.25)); $rules->addRule(new Rule('EE', 0.2)); $rules->addRule(new Rule('EL', 0.23)); $rules->addRule(new Rule('ES', 0.21)); $rules->addRule(new Rule('FI', 0.24)); $rules->addRule(new Rule('FR', 0.2)); $rules->addRule(new Rule('GB', 0.2)); $rules->addRule(new Rule('IE', 0.23)); $rules->addRule(new Rule('IT', 0.22)); $rules->addRule(new Rule('HR', 0.25)); $rules->addRule(new Rule('HU', 0.27)); $rules->addRule(new Rule('LV', 0.21)); $rules->addRule(new Rule('LT', 0.21)); $rules->addRule(new Rule('LU', 0.15)); $rules->addRule(new Rule('MT', 0.18)); $rules->addRule(new Rule('NL', 0.21)); $rules->addRule(new Rule('NO', 0.25)); $rules->addRule(new Rule('PL', 0.23)); $rules->addRule(new Rule('PT', 0.23)); $rules->addRule(new Rule('RO', 0.24)); $rules->addRule(new Rule('SE', 0.25)); $rules->addRule(new Rule('SK', 0.2)); $rules->addRule(new Rule('SI', 0.22)); return new Calculator($rules, $ownCountry); }