Zum Inhalt springen

API reference / Quittio \ Core \ Validation

ValidationContext

final readonly class in quittio/core

Quittio\Core\Validation\ValidationContext · Source

Information available to rules while validating an invoice.

Properties#

PropertyTypeDescription
$countryPacks readonlylist<CountryPack>leading pack first
$locale readonlystring
$messageLocale readonly?string
$options readonlyarray<string, mixed>e.g. attachment_max_bytes, attachments_max_total_bytes
$profile readonlyProfile
$translator readonly?Translator

Methods#

MethodDescription
->__construct()
->hasCountry()
->intOption()
->leadingCountry()
->messageLocale()Language of the messages: the configured one (validation.locale), otherwise the language of the run. Rules that check texts of the invoice use $locale instead.
->option()
->profileIs()
->translator()

__construct()#

public function __construct(
    Profile $profile,
    list<CountryPack> $countryPacks = [],
    string $locale = 'en',
    ?Translator $translator = null,
    array<string, mixed> $options = [],
    ?string $messageLocale = null,
)
ParameterTypeDescription
$profileProfile
$countryPackslist<CountryPack> = []leading pack first
$localestring = 'en'
$translator?Translator = null
$optionsarray<string, mixed> = []e.g. attachment_max_bytes, attachments_max_total_bytes
$messageLocale?string = null

hasCountry()#

public function hasCountry(string $code): bool
ParameterTypeDescription
$codestring
Returns
bool

intOption()#

public function intOption(string $key, int $default): int
ParameterTypeDescription
$keystring
$defaultint
Returns
int

leadingCountry()#

public function leadingCountry(): ?string
Returns
?string

messageLocale()#

public function messageLocale(): string

Language of the messages: the configured one (validation.locale), otherwise the language of the run. Rules that check texts of the invoice use $locale instead.

Returns
string

option()#

public function option(string $key, mixed $default = null): mixed
ParameterTypeDescription
$keystring
$defaultmixed = null
Returns
mixed

profileIs()#

public function profileIs(string ...$keys): bool
ParameterTypeDescription
...$keysstring
Returns
bool

translator()#

public function translator(): Translator
Returns
Translator

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.