‪TYPO3CMS  ‪main
TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator:
TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface

Public Member Functions

 isValid (mixed $value)
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator
 setOptions (array $options)
 validate (mixed $value)
 getOptions ()

Protected Attributes

array $supportedOptions
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator
bool $acceptsEmptyValues = true
array $supportedOptions = array( )
array $options = []
Result $result

Additional Inherited Members

- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator
 addError (string $message, int $code, array $arguments=[], string $title='')
 addErrorForProperty (string|array $propertyPath, string $message, int $code, array $arguments=[], string $title='')
 isEmpty (mixed $value)
 translateErrorMessage (string $translateKey, string $extensionName, array $arguments=[])
 initializeDefaultOptions (array $options)

Detailed Description

Validator for boolean values

Definition at line 23 of file BooleanValidator.php.

Member Function Documentation

◆ isValid()

TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator::isValid ( mixed  $value)

Check if $value matches the expectation given to the validator. If it does not match, the function adds an error to the result.

Also testing for '1' (true), '0' and '' (false) because casting varies between tests and actual usage. This makes the validator loose but still keeping functionality.

Reimplemented from TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator.

Definition at line 43 of file BooleanValidator.php.

References TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator\addError(), and TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator\translateErrorMessage().

Member Data Documentation

◆ $supportedOptions

array TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator::$supportedOptions
Initial value:
= array(
'is' => [null, 'Boolean value', 'boolean|string|integer'],

Definition at line 27 of file BooleanValidator.php.