interface ValidatesOne implements ValidatesAny (View source)

Interface for constraints that validate a single item.

Methods

void
check(mixed $value = null)

Checks if the given value is valid and throws an exception if not.

bool
isValid(mixed $value = null)

Checks if the given value is valid.

Result
validate(mixed $value = null)

Validates the given value and returns the validation result.

Details

void check(mixed $value = null)

Checks if the given value is valid and throws an exception if not.

Parameters

mixed $value

The value to validate.

Return Value

void

Exceptions

ValidationFailedException

bool isValid(mixed $value = null)

Checks if the given value is valid.

Parameters

mixed $value

The value to validate.

Return Value

bool

Whether the value is valid or not.

Result validate(mixed $value = null)

Validates the given value and returns the validation result.

Parameters

mixed $value

The value to validate.

Return Value

Result

The validation result (single or multiple).