update changelog and fix cs
This commit is contained in:
@@ -14,23 +14,25 @@ class Tax extends BaseTax
|
||||
/**
|
||||
* Provides a form-and-javascript-safe version of the type, which is a fully qualified classname, with \
|
||||
*/
|
||||
public static function escapeTypeName($name) {
|
||||
public static function escapeTypeName($name)
|
||||
{
|
||||
return str_replace('\\', '-', $name);
|
||||
}
|
||||
|
||||
public static function unescapeTypeName($name) {
|
||||
public static function unescapeTypeName($name)
|
||||
{
|
||||
return str_replace('-', '\\', $name);
|
||||
}
|
||||
|
||||
public function calculateTax($amount)
|
||||
{
|
||||
if(false === filter_var($amount, FILTER_VALIDATE_FLOAT)) {
|
||||
if (false === filter_var($amount, FILTER_VALIDATE_FLOAT)) {
|
||||
throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT);
|
||||
}
|
||||
|
||||
$rate = $this->getRate();
|
||||
|
||||
if($rate === null) {
|
||||
if ($rate === null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -41,7 +43,7 @@ class Tax extends BaseTax
|
||||
{
|
||||
try {
|
||||
$taxRuleCountryPosition = $this->getVirtualColumn(TaxRuleQuery::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION);
|
||||
} catch(PropelException $e) {
|
||||
} catch (PropelException $e) {
|
||||
throw new PropelException("Virtual column `" . TaxRuleQuery::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION . "` does not exist in Tax::getTaxRuleCountryPosition");
|
||||
}
|
||||
|
||||
@@ -53,13 +55,13 @@ class Tax extends BaseTax
|
||||
$class = $this->getType();
|
||||
|
||||
/* test type */
|
||||
if(!class_exists($class)) {
|
||||
if (!class_exists($class)) {
|
||||
throw new TaxEngineException('Recorded type `' . $class . '` does not exists', TaxEngineException::BAD_RECORDED_TYPE);
|
||||
}
|
||||
|
||||
$instance = new $class;
|
||||
|
||||
if(!$instance instanceof BaseTaxType) {
|
||||
if (!$instance instanceof BaseTaxType) {
|
||||
throw new TaxEngineException('Recorded type `' . $class . '` does not extends BaseTaxType', TaxEngineException::BAD_RECORDED_TYPE);
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@ class Tax extends BaseTax
|
||||
{
|
||||
$requirements = json_decode(base64_decode(parent::getSerializedRequirements()), true);
|
||||
|
||||
if(json_last_error() != JSON_ERROR_NONE || !is_array($requirements)) {
|
||||
if (json_last_error() != JSON_ERROR_NONE || !is_array($requirements)) {
|
||||
throw new TaxEngineException('BAD RECORDED REQUIREMENTS', TaxEngineException::BAD_RECORDED_REQUIREMENTS);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user