API reference / Quittio \ Core \ Validation \ Rules
CallbackRule
final readonly class in quittio/core · implements Rule
Quittio\Core\Validation\Rules\CallbackRule · Source
A rule defined by a closure. The closure receives the invoice and a reporter.
$fallback is the English message used when the message catalog has no entry.
Methods#
| Method | Description |
|---|---|
->__construct() | |
->check() | |
->code() | |
->fallbackMessage() | |
::l3() | |
::l7() | |
->level() | |
->namespace() |
__construct()#
public function __construct(
string $code,
ValidationLevel $level,
string $fallback,
Closure $check,
string $namespace = 'quittio',
)| Parameter | Type | Description |
|---|---|---|
$code | string | |
$level | ValidationLevel | |
$fallback | string | |
$check | Closure | |
$namespace | string = 'quittio' |
check()#
public function check(InvoiceData $invoice, ValidationContext $context): iterable| Parameter | Type | Description |
|---|---|---|
$invoice | InvoiceData | |
$context | ValidationContext |
- Returns
iterable
code()#
public function code(): string- Returns
string
fallbackMessage()#
public function fallbackMessage(): string- Returns
string
l3()#
public static function l3(
string $code,
string $fallback,
Closure $check,
string $namespace = 'quittio',
): self| Parameter | Type | Description |
|---|---|---|
$code | string | |
$fallback | string | |
$check | Closure | |
$namespace | string = 'quittio' |
- Returns
self
l7()#
public static function l7(
string $code,
string $fallback,
Closure $check,
string $namespace = 'quittio',
): self| Parameter | Type | Description |
|---|---|---|
$code | string | |
$fallback | string | |
$check | Closure | |
$namespace | string = 'quittio' |
- Returns
self
level()#
public function level(): ValidationLevel- Returns
ValidationLevel
namespace()#
public function namespace(): string- Returns
string