Skip to content

API reference / Quittio \ Core \ Countries

CountryRegistry

final class in quittio/core

Quittio\Core\Countries\CountryRegistry · Source

Installed country packs.

Methods#

MethodDescription
->__construct()
->all()
->get()The installed pack for the ISO country code $code (any case); null when none is installed.
->getOrGeneric()Returns the installed pack or a generic pack for the country.
->has()Whether a pack is installed for the ISO country code $code (any case).
->register()Installs $pack under its country code; it replaces a pack registered earlier for the same country. Changes this instance.
->taxPreset()The tax preset with this key from the presets of the installed packs, e.g. "de.standard".

__construct()#

public function __construct(iterable<CountryPack> $packs = [])
ParameterTypeDescription
$packsiterable<CountryPack> = []

all()#

public function all(): array<string, CountryPack>
Returns
array<string, CountryPack>

get()#

public function get(string $code): ?CountryPack

The installed pack for the ISO country code $code (any case); null when none is installed.

ParameterTypeDescription
$codestring
Returns
?CountryPack

getOrGeneric()#

public function getOrGeneric(string $code): CountryPack

Returns the installed pack or a generic pack for the country.

ParameterTypeDescription
$codestring
Returns
CountryPack

has()#

public function has(string $code): bool

Whether a pack is installed for the ISO country code $code (any case).

ParameterTypeDescription
$codestring
Returns
bool

register()#

public function register(CountryPack $pack): self

Installs $pack under its country code; it replaces a pack registered earlier for the same country. Changes this instance.

ParameterTypeDescription
$packCountryPack
Returns
self

taxPreset()#

public function taxPreset(string $key): ?TaxPreset

The tax preset with this key from the presets of the installed packs, e.g. "de.standard".

ParameterTypeDescription
$keystring
Returns
?TaxPreset

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