Class

eZ\Publish\Core\FieldType\Validator\FloatValueValidator

class FloatValueValidator extends Validator

Validator to validate ranges in float values.

Note that this validator can be limited by limitation on precision when dealing with floating point numbers, and conversions.

Properties

float $minFloatValue float$minFloatValueMinimum value for float.
float $maxFloatValue float$maxFloatValueMaximum value for float.

Methods

getConstraintsSchema()

Returns a schema for supported validator configurations.

from Validator
mixed validateConstraints(mixed $constraints)

bool validate(Value $value)

Perform validation on $value.

ValidationError[] getMessage()

Returns array of messages on performed validations.

from Validator
initializeWithConstraints(array $constraints)

Initialized an instance of Validator, with earlier configured constraints.

from Validator
mixed __get(string $name)

Magic getter.

from Validator
__set(string $name, mixed $value)

Magic setter.

from Validator

Details

in Validator at line 78
public getConstraintsSchema()

Returns a schema for supported validator configurations.

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.

at line 42
public mixed validateConstraints(mixed $constraints)

Parameters

mixed $constraints

Return Value

mixed

at line 87
public bool validate(Value $value)

Perform validation on $value.

Will return true when all constraints are matched. If one or more constraints fail, the method will return false.

When a check against a constant has failed, an entry will be added to the $errors array.

Parameters

Value $value

Return Value

bool

in Validator at line 112
public ValidationError[] getMessage()

Returns array of messages on performed validations.

When no validation errors occurred, the returned array should be empty.

Return Value

ValidationError[]

in Validator at line 126
public initializeWithConstraints(array $constraints)

Initialized an instance of Validator, with earlier configured constraints.

Parameters

array $constraints

in Validator at line 154
public mixed __get(string $name)

Magic getter.

Returns constraint value, from its $name.

Parameters

string $name

Return Value

mixed

Exceptions

PropertyNotFoundException

in Validator at line 172
public __set(string $name, mixed $value)

Magic setter.

Sets $value to constraint, identified by $name.

Parameters

string $name
mixed $value

Exceptions

PropertyNotFoundException