API reference / Quittio \ Core \ Tax
TaxPresetCollection
final class in quittio/core · implements Countable, IteratorAggregate
Quittio\Core\Tax\TaxPresetCollection · Source
Methods#
| Method | Description |
|---|---|
->__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 = [])| Parameter | Type | Description |
|---|---|---|
$presets | iterable<TaxPreset> = [] |
add()#
public function add(TaxPreset $preset): selfAdds $preset under its key(), replacing a preset with the same key. Changes this instance.
| Parameter | Type | Description |
|---|---|---|
$preset | TaxPreset |
- Returns
self
alias()#
public function alias(string $key, TaxPreset $preset): selfMakes 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.
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$preset | TaxPreset |
- Returns
self
count()#
public function count(): intNumber of presets, without aliases.
- Returns
int
get()#
public function get(string $key): TaxPresetReturns the preset or alias under $key; throws InvalidArgumentException for an unknown key.
| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
TaxPreset
getIterator()#
public function getIterator(): TraversableIterates the presets by key, without aliases.
- Returns
Traversable
has()#
public function has(string $key): boolWhether a preset or an alias exists under $key, e.g. "de.standard".
| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
bool