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#
| Method | Description |
|---|---|
->__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 = [])| Parameter | Type | Description |
|---|---|---|
$profiles | iterable<Profile> = [] |
alias()#
public function alias(string $alias, string $key): selfMakes $alias (case-insensitive) another name for the profile key $key, e.g. "comfort" for "en16931". Changes this instance.
| Parameter | Type | Description |
|---|---|---|
$alias | string | |
$key | string |
- Returns
self
all()#
public function all(): array<string, Profile>- Returns
array<string, Profile>
bySpecificationId()#
public function bySpecificationId(string $specificationId): ?ProfileFinds the profile for a specification identifier (BT-24), e.g. when reading an invoice.
| Parameter | Type | Description |
|---|---|---|
$specificationId | string |
- Returns
?Profile
get()#
public function get(Profile|string $profile): ProfileThe 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.
| Parameter | Type | Description |
|---|---|---|
$profile | Profile|string |
- Returns
Profile
has()#
public function has(string $key): boolWhether a profile is registered under $key or an alias of it, ignoring case.
| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
bool
register()#
public function register(Profile $profile): selfAdds $profile under its key(); a profile with the same key is replaced. Changes this instance.
| Parameter | Type | Description |
|---|---|---|
$profile | Profile |
- Returns
self
withDefaults()#
public static function withDefaults(): selfA 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