CallbackRule
in package
implements
Rule
Read onlyYes
FinalYes
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.
Table of Contents
Interfaces
- Rule
- A business or plausibility rule checked in PHP (levels L1 to L3 and L7).
Methods
- __construct() : mixed
- check() : iterable<string|int, ValidationMessage>
- code() : string
- Official rule code (e.g. BR-CO-25, BR-DE-1) or a package code (QUITTIO-…).
- fallbackMessage() : string
- l3() : self
- l7() : self
- level() : ValidationLevel
- namespace() : string
Methods
__construct()
public
__construct(string $code, ValidationLevel $level, string $fallback, callable(InvoiceData, RuleReporter): void $check[, string $namespace = 'quittio' ]) : mixed
Parameters
- $code : string
- $level : ValidationLevel
- $fallback : string
- $check : callable(InvoiceData, RuleReporter): void
- $namespace : string = 'quittio'
check()
public
check(InvoiceData $invoice, ValidationContext $context) : iterable<string|int, ValidationMessage>
Parameters
- $invoice : InvoiceData
- $context : ValidationContext
Return values
iterable<string|int, ValidationMessage>code()
Official rule code (e.g. BR-CO-25, BR-DE-1) or a package code (QUITTIO-…).
public
code() : string
Return values
stringfallbackMessage()
public
fallbackMessage() : string
Return values
stringl3()
public
static l3(string $code, string $fallback, callable(InvoiceData, RuleReporter): void $check[, string $namespace = 'quittio' ]) : self
Parameters
- $code : string
- $fallback : string
- $check : callable(InvoiceData, RuleReporter): void
- $namespace : string = 'quittio'
Return values
selfl7()
public
static l7(string $code, string $fallback, callable(InvoiceData, RuleReporter): void $check[, string $namespace = 'quittio' ]) : self
Parameters
- $code : string
- $fallback : string
- $check : callable(InvoiceData, RuleReporter): void
- $namespace : string = 'quittio'
Return values
selflevel()
public
level() : ValidationLevel
Return values
ValidationLevelnamespace()
public
namespace() : string