API reference / Quittio \ Core \ Formats
FormatRegistry
final class in quittio/core
Quittio\Core\Formats\FormatRegistry · Source
Known output formats. Country and network packages can register national formats.
Constants#
| Constant | Value | Description |
|---|---|---|
CII | 'cii' | |
FACTUR_X | 'factur-x' | |
HTML | 'html' | |
JSON | 'json' | |
PDF | 'pdf' | |
PEPPOL | 'peppol' | |
UBL | 'ubl' | |
ZUGFERD | 'zugferd' |
Methods#
| Method | Description |
|---|---|
->alias() | Makes $alias (any case) another name for the format $key, e.g. "factur-x" for "zugferd". Changes this instance. |
->all() | |
->get() | The format registered under $key or an alias of it (any case). |
->has() | Whether a format is registered under $key or an alias of it (any case). |
->register() | Registers $format under its key; it replaces a format registered earlier under the same key. Changes this instance. |
::withDefaults() | A registry with the built-in formats zugferd (alias factur-x, facturx), cii, ubl, peppol, pdf, html and json. |
alias()#
public function alias(string $alias, string $key): selfMakes $alias (any case) another name for the format $key, e.g. "factur-x" for "zugferd". Changes this instance.
| Parameter | Type | Description |
|---|---|---|
$alias | string | |
$key | string |
- Returns
self
all()#
public function all(): array<string, OutputFormat>- Returns
array<string, OutputFormat>
get()#
public function get(string $key): OutputFormatThe format registered under $key or an alias of it (any case).
| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
OutputFormat- Throws
ConfigurationException– when no such format is registered
has()#
public function has(string $key): boolWhether a format is registered under $key or an alias of it (any case).
| Parameter | Type | Description |
|---|---|---|
$key | string |
- Returns
bool
register()#
public function register(OutputFormat $format): selfRegisters $format under its key; it replaces a format registered earlier under the same key. Changes this instance.
| Parameter | Type | Description |
|---|---|---|
$format | OutputFormat |
- Returns
self
withDefaults()#
public static function withDefaults(): selfA registry with the built-in formats zugferd (alias factur-x, facturx), cii, ubl, peppol, pdf, html and json.
- Returns
self