EmptyValidator extends AbstractValidator

FinalYes

Validator for empty values.

Scope: frontend

Table of Contents

Properties

$acceptsEmptyValues  : bool
This validator always needs to be executed even if the given value is empty.
$options  : array<string|int, mixed>
$result  : Result
$supportedOptions  : array<string|int, mixed>
This contains the supported options, their default values, types and descriptions.

Methods

getOptions()  : array<string|int, mixed>
Returns the options of this validator
isValid()  : void
Checks if the given property ($propertyValue) is empty (NULL, empty string, empty array or empty object).
setOptions()  : void
Receive validator options from framework.
validate()  : Result
Checks if the given value is valid according to the validator, and returns the error messages object which occurred.
addError()  : void
Creates a new validation error object and adds it to $this->result
addErrorForProperty()  : void
Creates a new validation error object for a property and adds it to the proper sub result of $this->result
initializeDefaultOptions()  : void
Initialize default options.
isEmpty()  : bool
TRUE if the given $value is NULL or an empty string ('')
translateErrorMessage()  : string
Wrap static call to LocalizationUtility to simplify unit testing.

Properties

$acceptsEmptyValues

This validator always needs to be executed even if the given value is empty.

protected bool $acceptsEmptyValues = true

See AbstractValidator::validate()

$options

protected array<string|int, mixed> $options = []

$supportedOptions

This contains the supported options, their default values, types and descriptions.

protected array<string|int, mixed> $supportedOptions = []

Methods

getOptions()

Returns the options of this validator

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

isValid()

Checks if the given property ($propertyValue) is empty (NULL, empty string, empty array or empty object).

public isValid(mixed $value) : void
Parameters
$value : mixed

setOptions()

Receive validator options from framework.

public setOptions(array<string|int, mixed> $options) : void
Parameters
$options : array<string|int, mixed>

validate()

Checks if the given value is valid according to the validator, and returns the error messages object which occurred.

public validate(mixed $value) : Result
Parameters
$value : mixed

The value that should be validated

Return values
Result

addError()

Creates a new validation error object and adds it to $this->result

protected addError(string $message, int $code[, array<string|int, mixed> $arguments = [] ][, string $title = '' ]) : void
Parameters
$message : string

The error message

$code : int

The error code (a unix timestamp)

$arguments : array<string|int, mixed> = []

Arguments to be replaced in message

$title : string = ''

title of the error

addErrorForProperty()

Creates a new validation error object for a property and adds it to the proper sub result of $this->result

protected addErrorForProperty(string|array<string|int, mixed> $propertyPath, string $message, int $code[, array<string|int, mixed> $arguments = [] ][, string $title = '' ]) : void
Parameters
$propertyPath : string|array<string|int, mixed>

The property path (string or array)

$message : string

The error message

$code : int

The error code (a unix timestamp)

$arguments : array<string|int, mixed> = []

Arguments to be replaced in message

$title : string = ''

Title of the error

initializeDefaultOptions()

Initialize default options.

protected initializeDefaultOptions(array<string|int, mixed> $options) : void
Parameters
$options : array<string|int, mixed>
Tags
throws
InvalidValidationOptionsException

isEmpty()

TRUE if the given $value is NULL or an empty string ('')

protected final isEmpty(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

translateErrorMessage()

Wrap static call to LocalizationUtility to simplify unit testing.

protected translateErrorMessage(string $translateKey, string $extensionName[, array<string|int, mixed> $arguments = [] ]) : string
Parameters
$translateKey : string
$extensionName : string
$arguments : array<string|int, mixed> = []
Return values
string

        
On this page

Search results