Skip to content

API reference / Quittio \ Core \ Tax

TaxPresetCollection

final class in quittio/core · implements Countable, IteratorAggregate

Quittio\Core\Tax\TaxPresetCollection · Source

Methods#

MethodDescription
->__construct()
->add()Adds $preset under its key(), replacing a preset with the same key. Changes this instance.
->alias()Makes a preset available under a further key, e.g. the key of an earlier version that stored data still carries. has() and get() find it; iterating and count() list only the presets.
->count()Number of presets, without aliases.
->get()Returns the preset or alias under $key; throws InvalidArgumentException for an unknown key.
->getIterator()Iterates the presets by key, without aliases.
->has()Whether a preset or an alias exists under $key, e.g. "de.standard".

__construct()#

public function __construct(iterable<TaxPreset> $presets = [])
ParameterTypeDescription
$presetsiterable<TaxPreset> = []

add()#

public function add(TaxPreset $preset): self

Adds $preset under its key(), replacing a preset with the same key. Changes this instance.

ParameterTypeDescription
$presetTaxPreset
Returns
self

alias()#

public function alias(string $key, TaxPreset $preset): self

Makes a preset available under a further key, e.g. the key of an earlier version that stored data still carries. has() and get() find it; iterating and count() list only the presets.

ParameterTypeDescription
$keystring
$presetTaxPreset
Returns
self

count()#

public function count(): int

Number of presets, without aliases.

Returns
int

get()#

public function get(string $key): TaxPreset

Returns the preset or alias under $key; throws InvalidArgumentException for an unknown key.

ParameterTypeDescription
$keystring
Returns
TaxPreset

getIterator()#

public function getIterator(): Traversable

Iterates the presets by key, without aliases.

Returns
Traversable

has()#

public function has(string $key): bool

Whether a preset or an alias exists under $key, e.g. "de.standard".

ParameterTypeDescription
$keystring
Returns
bool

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.