InvoiceValidator
extends AbstractValidator
in package
Validator is a singleton base class for classes validating DomainObjects.
Table of Contents
- $instance : AbstractValidator
- Stores the single instance of Validator.
- $validators : array<string|int, callable>
- Needs to be declared in every childclass
- getInstance() : Validator
- Returnst the instances of the validator, instantiates a new one if there isn't one already.
- getValidators() : mixed
- Returns the validator functions.
- validate() : ResultCollection|bool
- Validates a DomainObject.
- __construct() : mixed
- Implement constructor in childclasses and assign the validator functions to using setValidators() All sub-classes should have protected constructors.
- setValidators() : mixed
- Sets the validator functions.
Properties
$instance
Stores the single instance of Validator.
protected
static AbstractValidator
$instance
$validators
Needs to be declared in every childclass
protected
array<string|int, callable>
$validators
= []
A list of tests used to validate domainObjects dataTypes, indexed by fieldname
Methods
getInstance()
Returnst the instances of the validator, instantiates a new one if there isn't one already.
public
static getInstance() : Validator
Return values
Validator —getValidators()
Returns the validator functions.
public
getValidators() : mixed
Return values
mixed —validate()
Validates a DomainObject.
public
validate(DomainObject $domainObject) : ResultCollection|bool
Parameters
- $domainObject : DomainObject
Return values
ResultCollection|bool —returns true if validations passed a ResultCollection otherwise
__construct()
Implement constructor in childclasses and assign the validator functions to using setValidators() All sub-classes should have protected constructors.
protected
__construct() : mixed
Return values
mixed —setValidators()
Sets the validator functions.
protected
setValidators(mixed $tests) : mixed
Parameters
- $tests : mixed