PHP Class Neos\Flow\Validation\Validator\AbstractValidator

Inheritance: implements Neos\Flow\Validation\Validator\ValidatorInterface
Show file Open project: neos/flow-development-collection

Protected Properties

Property Type Description
$acceptsEmptyValues boolean If this is TRUE, the validators isValid() method is not called in case of an empty value Note: A value is considered empty if it is NULL or an empty string! By default all validators except for NotEmpty and the Composite Validators accept empty values
$options array
$result Neos\Error\Messages\Result
$supportedOptions array 0 => default value 1 => description 2 => type 3 => required (boolean, optional)

Public Methods

Method Description
__construct ( array $options = [] ) Constructs the validator and sets validation options
getOptions ( ) : array Returns the options of this validator
validate ( mixed $value ) : Neos\Error\Messages\Result Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred.

Protected Methods

Method Description
addError ( string $message, integer $code, array $arguments = [] ) : void Creates a new validation error object and adds it to $this->errors
isEmpty ( mixed $value ) : boolean
isValid ( mixed $value ) : void Check if $value is valid. If it is not valid, needs to add an error to Result.

Method Details

__construct() public method

Constructs the validator and sets validation options
public __construct ( array $options = [] )
$options array Options for the validator

addError() protected method

Creates a new validation error object and adds it to $this->errors
protected addError ( string $message, integer $code, array $arguments = [] ) : void
$message string The error message
$code integer The error code (a unix timestamp)
$arguments array Arguments to be replaced in message
return void

getOptions() public method

Returns the options of this validator
public getOptions ( ) : array
return array

isEmpty() final protected method

final protected isEmpty ( mixed $value ) : boolean
$value mixed
return boolean TRUE if the given $value is NULL or an empty string ('')

isValid() abstract protected method

Check if $value is valid. If it is not valid, needs to add an error to Result.
abstract protected isValid ( mixed $value ) : void
$value mixed
return void

validate() public method

Checks if the given value is valid according to the validator, and returns the Error Messages object which occurred.
public validate ( mixed $value ) : Neos\Error\Messages\Result
$value mixed The value that should be validated
return Neos\Error\Messages\Result

Property Details

$acceptsEmptyValues protected property

If this is TRUE, the validators isValid() method is not called in case of an empty value Note: A value is considered empty if it is NULL or an empty string! By default all validators except for NotEmpty and the Composite Validators accept empty values
protected bool $acceptsEmptyValues
return boolean

$options protected property

protected array $options
return array

$result protected property

protected Result,Neos\Error\Messages $result
return Neos\Error\Messages\Result

$supportedOptions protected property

0 => default value 1 => description 2 => type 3 => required (boolean, optional)
protected array $supportedOptions
return array