Skip to content

API reference / Quittio \ Core \ Profiles

ProfileRegistry

final class in quittio/core

Quittio\Core\Profiles\ProfileRegistry · Source

Known profiles by key. Country packs and network packages register further profiles.

Methods#

MethodDescription
->__construct()
->alias()Makes $alias (case-insensitive) another name for the profile key $key, e.g. "comfort" for "en16931". Changes this instance.
->all()
->bySpecificationId()Finds the profile for a specification identifier (BT-24), e.g. when reading an invoice.
->get()The profile with this key or alias, ignoring case; a Profile instance is returned as is. Throws an InvalidArgumentException that lists the known keys for an unknown profile.
->has()Whether a profile is registered under $key or an alias of it, ignoring case.
->register()Adds $profile under its key(); a profile with the same key is replaced. Changes this instance.
::withDefaults()A registry with the built-in profiles (MINIMUM, BASIC WL, BASIC, EN 16931, EXTENDED, Peppol BIS 3) and the aliases basicwl, en-16931, comfort and peppol-bis-3.

__construct()#

public function __construct(iterable<Profile> $profiles = [])
ParameterTypeDescription
$profilesiterable<Profile> = []

alias()#

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

Makes $alias (case-insensitive) another name for the profile key $key, e.g. "comfort" for "en16931". Changes this instance.

ParameterTypeDescription
$aliasstring
$keystring
Returns
self

all()#

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

bySpecificationId()#

public function bySpecificationId(string $specificationId): ?Profile

Finds the profile for a specification identifier (BT-24), e.g. when reading an invoice.

ParameterTypeDescription
$specificationIdstring
Returns
?Profile

get()#

public function get(Profile|string $profile): Profile

The profile with this key or alias, ignoring case; a Profile instance is returned as is. Throws an InvalidArgumentException that lists the known keys for an unknown profile.

ParameterTypeDescription
$profileProfile|string
Returns
Profile

has()#

public function has(string $key): bool

Whether a profile is registered under $key or an alias of it, ignoring case.

ParameterTypeDescription
$keystring
Returns
bool

register()#

public function register(Profile $profile): self

Adds $profile under its key(); a profile with the same key is replaced. Changes this instance.

ParameterTypeDescription
$profileProfile
Returns
self

withDefaults()#

public static function withDefaults(): self

static

A registry with the built-in profiles (MINIMUM, BASIC WL, BASIC, EN 16931, EXTENDED, Peppol BIS 3) and the aliases basicwl, en-16931, comfort and peppol-bis-3.

Returns
self

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