Quittio 0.3 API

RuleOverrides
in package

Read onlyYes
FinalYes

Changes to the PHP rules by rule code: rules switched off, findings with another severity and rules replaced by own implementations. Codes match exactly or, with a trailing "*", by prefix (e.g. "DE-USTG-*"). The overrides apply to the PHP rules only; the findings of the XSD schema, KoSIT and veraPDF are never changed.

The rules of EN 16931 (BR-) and Peppol (PEPPOL-) are official: switching them off, changing their severity or replacing them needs $allowOfficial, because an invoice that breaks them is rejected by the receiver.

Table of Contents

Properties

$allowOfficial  : bool
$disabled  : array<string|int, mixed>
$replacements  : array<string|int, mixed>
$severities  : array<string|int, mixed>

Methods

__construct()  : mixed
apply()  : array<int, Rule>
The rules without the disabled ones, replaced rules exchanged in place.
applyToMessages()  : array<int, ValidationMessage>
The findings without those of disabled codes, with the configured severities. Rules may report other codes than their own (e.g. QUITTIO-PROFILE-REQUIRED), so the findings are filtered as well.
fromArray()  : self
From the configuration keys disabled (list of codes), severity (code => error, warning or info) and allow_official.
isDisabled()  : bool
Whether findings with this code are dropped.
isEmpty()  : bool
Whether nothing is disabled, re-rated or replaced.
matches()  : bool
Whether a pattern matches a code: exactly, or by prefix with a trailing "*".
merge()  : self
These overrides with those of $other on top: $other wins for the same code.
patterns()  : array<int, string>
Every pattern of these overrides, e.g. to check them against the known rule codes.

Properties

$replacements

public array<string|int, mixed> $replacements = []

$severities

public array<string|int, mixed> $severities = []

Methods

__construct()

public __construct([array<int, string> $disabled = [] ][, array<string, Severity> $severities = [] ][, array<string, Rule> $replacements = [] ][, bool $allowOfficial = false ]) : mixed
Parameters
$disabled : array<int, string> = []

codes or prefixes ending with "*" whose rules and findings are dropped

$severities : array<string, Severity> = []

severity of the findings per code or prefix

$replacements : array<string, Rule> = []

rules that replace the rule with the code of the key

$allowOfficial : bool = false
Tags
throws
ConfigurationException

when an official rule is changed without $allowOfficial or a pattern is empty

apply()

The rules without the disabled ones, replaced rules exchanged in place.

public apply(array<int, Rule> $rules) : array<int, Rule>
Parameters
$rules : array<int, Rule>
Return values
array<int, Rule>

applyToMessages()

The findings without those of disabled codes, with the configured severities. Rules may report other codes than their own (e.g. QUITTIO-PROFILE-REQUIRED), so the findings are filtered as well.

public applyToMessages(array<int, ValidationMessage> $messages) : array<int, ValidationMessage>
Parameters
$messages : array<int, ValidationMessage>
Return values
array<int, ValidationMessage>

fromArray()

From the configuration keys disabled (list of codes), severity (code => error, warning or info) and allow_official.

public static fromArray(array<string|int, mixed> $config) : self
Parameters
$config : array<string|int, mixed>
Tags
throws
ConfigurationException

for an unknown severity or an official rule without allow_official

Return values
self

isDisabled()

Whether findings with this code are dropped.

public isDisabled(string $code) : bool
Parameters
$code : string
Return values
bool

isEmpty()

Whether nothing is disabled, re-rated or replaced.

public isEmpty() : bool
Return values
bool

matches()

Whether a pattern matches a code: exactly, or by prefix with a trailing "*".

public static matches(string $pattern, string $code) : bool
Parameters
$pattern : string
$code : string
Return values
bool

merge()

These overrides with those of $other on top: $other wins for the same code.

public merge(self $other) : self
Parameters
$other : self
Return values
self

patterns()

Every pattern of these overrides, e.g. to check them against the known rule codes.

public patterns() : array<int, string>
Return values
array<int, string>
On this page

Search results