TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
AbstractValidator Class Reference
Inheritance diagram for AbstractValidator:
ValidatorInterface AbstractValidatorClass AlphanumericValidator BooleanValidator DateTimeValidator EmailAddressValidator FloatValidator GenericObjectValidator IntegerValidator NotEmptyValidator NumberRangeValidator NumberValidator RawValidator RegularExpressionValidator StringLengthValidator StringValidator TextValidator CountValidator EmptyValidator MimeTypeValidator TestValidator

Public Member Functions

 __construct (array $options=[])
 
 validate ($value)
 
 getOptions ()
 

Protected Member Functions

 isValid ($value)
 
 addError ($message, $code, array $arguments=[], $title= '')
 
 isEmpty ($value)
 
 translateErrorMessage ($translateKey, $extensionName, $arguments=[])
 

Protected Attributes

 $acceptsEmptyValues = true
 
 $supportedOptions = []
 
 $options = []
 
 $result
 

Detailed Description

Abstract validator

Definition at line 22 of file AbstractValidator.php.

Constructor & Destructor Documentation

__construct ( array  $options = [])

Constructs the validator and sets validation options

Parameters
array$optionsOptions for the validator
Exceptions
InvalidValidationOptionsException

Definition at line 59 of file AbstractValidator.php.

References AbstractValidator\$options, and AbstractValidator\$supportedOptions.

Member Function Documentation

addError (   $message,
  $code,
array  $arguments = [],
  $title = '' 
)
protected
getOptions ( )

Returns the options of this validator

Returns
array

Implements ValidatorInterface.

Definition at line 134 of file AbstractValidator.php.

References AbstractValidator\$options.

isEmpty (   $value)
finalprotected
Parameters
mixed$value
Returns
bool TRUE if the given $value is NULL or an empty string ('')

Definition at line 143 of file AbstractValidator.php.

Referenced by GenericObjectValidator\validate(), CollectionValidator\validate(), and AbstractValidator\validate().

isValid (   $value)
abstractprotected

Check if $value is valid. If it is not valid, needs to add an error to result.

Parameters
mixed$value
Returns
void

Referenced by AbstractValidator\validate().

translateErrorMessage (   $translateKey,
  $extensionName,
  $arguments = [] 
)
protected
validate (   $value)

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

Parameters
mixed$valueThe value that should be validated
Returns

Implements ValidatorInterface.

Definition at line 97 of file AbstractValidator.php.

References AbstractValidator\$result, AbstractValidator\isEmpty(), and AbstractValidator\isValid().

Member Data Documentation

$acceptsEmptyValues = true
protected

Definition at line 33 of file AbstractValidator.php.

$options = []
protected
$supportedOptions = []
protected

Definition at line 40 of file AbstractValidator.php.

Referenced by AbstractValidator\__construct().