class TaxCalculator

Class TaxCalculator

Constants

DISABLE_METHOD

DISABLE_METHOD only use this tax.

COMBINE_METHOD

COMBINE_METHOD sum taxes eg: 100€ * (10% + 15%).

ONE_AFTER_ANOTHER_METHOD

ONEAFTERANOTHER_METHOD apply taxes one after another eg: (100€ * 10%) * 15%.

Properties

array $taxes
int $computation_method

Methods

__construct( array $taxes = array(), int $computation_method = self::COMBINE_METHOD)

Constructor.

float
addTaxes( float $price)

Compute and add the taxes to the specified price.

float
removeTaxes( float $price)

Compute and remove the taxes to the specified price.

float
getTotalRate()

get Total Rate.

string
getTaxesName( null $language = null)

get Tax Names.

float|array
getTaxesAmount( float $price, bool $asArray = false)

Return the tax amount associated to each taxes of the TaxCalculator.

Tax[]
getTaxes()

Get taxes.

getComputationMethod()

return computation mode.

Details

at line line 56
__construct( array $taxes = array(), int $computation_method = self::COMBINE_METHOD)

Constructor.

Parameters

array $taxes
int $computation_method (COMBINEMETHOD | ONEAFTERANOTHERMETHOD)

at line line 69
float addTaxes( float $price)

Compute and add the taxes to the specified price.

Parameters

float $price price tax excluded

Return Value

float price with taxes

at line line 81
float removeTaxes( float $price)

Compute and remove the taxes to the specified price.

Parameters

float $price price tax inclusive

Return Value

float price without taxes

at line line 91
float getTotalRate()

get Total Rate.

Return Value

float total taxes rate

at line line 118
string getTaxesName( null $language = null)

get Tax Names.

Parameters

null $language

Return Value

string

at line line 138
float|array getTaxesAmount( float $price, bool $asArray = false)

Return the tax amount associated to each taxes of the TaxCalculator.

Parameters

float $price
bool $asArray

Return Value

float|array $taxes_amount

at line line 168
Tax[] getTaxes()

Get taxes.

Return Value

Tax[]

at line line 176
getComputationMethod()

return computation mode.