Documentation

AbstractValidator
in package
implements Validator uses Log

AbstractYes

Validator is a singleton base class for classes validating DomainObjects.

Table of Contents

Interfaces

Validator

Properties

$instance  : Validator
Stores the single instance of Validator.
$validators  : array<string|int, callable>
Needs to be declared in every childclass

Methods

addValidator()  : mixed
Dynamically add a validator function
getInstance()  : Validator
Returnst the instances of the validator, instantiates a new one if there isn't one already.
getValidators()  : mixed
Returns the validator functions.
removeValidator()  : mixed
Dynamiocally remove a validator function
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 Validator $instance
Tags
abstract

Needs to be redeclared in every child class

$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

addValidator()

Dynamically add a validator function

public addValidator(string $field, callable $validator[, string $validatorIndex = null ]) : mixed
Parameters
$field : string

The DomainObject Field to validate

$validator : callable

The Validator function to use

$validatorIndex : string = null

The internal index used to store the validator function. Use this to remove or overwrite the validator

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

removeValidator()

Dynamiocally remove a validator function

public removeValidator(string $field[, mixed $validatorIndex = null ]) : mixed
Parameters
$field : string
$validatorIndex : mixed = null

__construct()

Implement constructor in childclasses and assign the validator functions to using setValidators() All sub-classes should have protected constructors.

protected abstract __construct() : mixed

setValidators()

Sets the validator functions.

protected setValidators(mixed $tests) : mixed
Parameters
$tests : mixed

        
On this page

Search results