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#
| Property | Type | Description |
|---|---|---|
$countryPacks readonly | list<CountryPack> | leading pack first |
$locale readonly | string | |
$messageLocale readonly | ?string | |
$options readonly | array<string, mixed> | e.g. attachment_max_bytes, attachments_max_total_bytes |
$profile readonly | Profile | |
$translator readonly | ?Translator |
Methods#
| Method | Description |
|---|---|
->__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,
)| Parameter | Type | Description |
|---|---|---|
$profile | Profile | |
$countryPacks | list<CountryPack> = [] | leading pack first |
$locale | string = 'en' | |
$translator | ?Translator = null | |
$options | array<string, mixed> = [] | e.g. attachment_max_bytes, attachments_max_total_bytes |
$messageLocale | ?string = null |
hasCountry()#
public function hasCountry(string $code): bool| Parameter | Type | Description |
|---|---|---|
$code | string |
- Returns
bool
intOption()#
public function intOption(string $key, int $default): int| Parameter | Type | Description |
|---|---|---|
$key | string | |
$default | int |
- Returns
int
leadingCountry()#
public function leadingCountry(): ?string- Returns
?string
messageLocale()#
public function messageLocale(): stringLanguage 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| Parameter | Type | Description |
|---|---|---|
$key | string | |
$default | mixed = null |
- Returns
mixed
profileIs()#
public function profileIs(string ...$keys): bool| Parameter | Type | Description |
|---|---|---|
...$keys | string |
- Returns
bool
translator()#
public function translator(): Translator- Returns
Translator