PHP Класс eZ\Publish\Core\FieldType\Validator

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$constraints array Key is the constraint name, value is the default value. If no default value is needed, just set to false. Example: With no default value protected $constraints = array( "maxStringLength" => false ); With a default value protected $constraints = array( "minIntegerValue" => 0, "maxIntegerValue" => 40 );
$constraintsSchema mixed A one dimensional map with validator parameters.
$errors eZ\Publish\SPI\FieldType\ValidationError[] The errors collected during validation.

Открытые методы

Метод Описание
__get ( string $name ) : mixed Magic getter.
__set ( string $name, mixed $value ) Magic setter.
getConstraintsSchema ( ) Returns a schema for supported validator configurations.
getMessage ( ) : eZ\Publish\SPI\FieldType\ValidationError[] Returns array of messages on performed validations.
initializeWithConstraints ( array $constraints ) Initialized an instance of Validator, with earlier configured constraints.
validate ( Value $value ) : boolean Perform validation on $value.
validateConstraints ( mixed $constraints ) : mixed

Описание методов

__get() публичный метод

Returns constraint value, from its $name.
public __get ( string $name ) : mixed
$name string
Результат mixed

__set() публичный метод

Sets $value to constraint, identified by $name.
public __set ( string $name, mixed $value )
$name string
$value mixed

getConstraintsSchema() публичный метод

This implementation returns a three dimensional map containing for each validator configuration referenced by identifier a map of supported parameters which are defined by a type and a default value (see example). Example: array( 'stringLength' => array( 'minStringLength' => array( 'type' => 'int', 'default' => 0, ), 'maxStringLength' => array( 'type' => 'int' 'default' => null, ) ), ); The validator identifier.

getMessage() публичный метод

When no validation errors occurred, the returned array should be empty.
public getMessage ( ) : eZ\Publish\SPI\FieldType\ValidationError[]
Результат eZ\Publish\SPI\FieldType\ValidationError[]

initializeWithConstraints() публичный метод

Initialized an instance of Validator, with earlier configured constraints.
public initializeWithConstraints ( array $constraints )
$constraints array

validate() абстрактный публичный метод

Will return true when all constraints are matched. If one or more constraints fail, the method will return false. When a check against a constraint has failed, an entry will be added to the $errors array.
abstract public validate ( Value $value ) : boolean
$value Value
Результат boolean

validateConstraints() абстрактный публичный метод

abstract public validateConstraints ( mixed $constraints ) : mixed
$constraints mixed
Результат mixed

Описание свойств

$constraints защищенное свойство

Key is the constraint name, value is the default value. If no default value is needed, just set to false. Example: With no default value protected $constraints = array( "maxStringLength" => false ); With a default value protected $constraints = array( "minIntegerValue" => 0, "maxIntegerValue" => 40 );
protected array $constraints
Результат array

$constraintsSchema защищенное свойство

A one dimensional map with validator parameters.
protected mixed $constraintsSchema
Результат mixed

$errors защищенное свойство

The errors collected during validation.
protected ValidationError[],eZ\Publish\SPI\FieldType $errors
Результат eZ\Publish\SPI\FieldType\ValidationError[]