\phpWTLaBasicDataValidator

Abstract class for a content (logger field) validator.

Summary

Methods
Properties
Constants
getInstance()
validate()
isValid()
No public properties found
No constants found
__clone()
__sleep()
__wakeup()
__construct()
$_instance
$loggerContent
$fieldDescriptor
N/A
No private methods found
No private properties found
N/A

Properties

$_instance

$_instance : 

Array to hold instances of all derived classes.

Type

$loggerContent

$loggerContent : 

Type

$fieldDescriptor

$fieldDescriptor : 

Type

Methods

getInstance()

getInstance(array|mixed|null  $inject = null) : \phpWTL\$_instance[$class]

Create new instance or give back already existing one.

Parameters

array|mixed|null $inject

Can be used to inject one or more parameter(s) into the constructor

Returns

\phpWTL\$_instance[$class] —

The instance of a derived class

validate()

validate() : array

Validate all log fields.

Returns

array —

Validation errors (contains field names which did not validate), null if none

isValid()

isValid(string  $field_name, string  $value = null) : boolean

Validate data for a single log field.

Parameters

string $field_name

ID of log format field.

string $value

Provide an (optional) value to validate, so allowing for the validation of external data (by default validation will be performed on the LoggerContent object).

Returns

boolean —

Field valid?.

__clone()

__clone() 

Disable cloning for singleton.

Throws

\phpWTL\Exception

if called

__sleep()

__sleep() 

Disable serialization for singleton.

Throws

\phpWTL\Exception

if called

__wakeup()

__wakeup() 

Disable de-serialization for singleton.

Throws

\phpWTL\Exception

if called

__construct()

__construct(object  $loggerContent = null) 

Constructor stump.

Parameters

object $loggerContent

Provide a LoggerContent object. Also store the format blueprint via the LoggerContent object (which knows its FormatDescriptor).