PHP 클래스 eZ\Publish\Core\FieldType\Validator

파일 보기 프로젝트 열기: ezsystems/ezpublish-kernel

보호된 프로퍼티들

프로퍼티 타입 설명
$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[]