TYPO3 CMS
TYPO3_6-2
Main Page
Related Pages
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
+
Files
File List
+
File Members
+
All
$
(
_
a
c
d
e
f
h
i
l
o
p
r
s
t
u
x
+
Functions
_
a
c
d
e
f
i
l
o
p
r
s
u
x
+
Variables
$
(
_
a
d
e
h
i
p
r
s
t
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
BooleanValidator.php
Go to the documentation of this file.
1
<?php
2
namespace
TYPO3\CMS\Extbase\Validation\Validator
;
3
19
class
BooleanValidator
extends
\TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator
{
20
24
protected
$supportedOptions
= array(
25
// The default is set to NULL here, because we need to be backward compatible here, because this
26
// BooleanValidator is called automatically on boolean action arguments. If we would set it to TRUE,
27
// every FALSE value for an action argument would break.
28
// TODO with next patches: deprecate this BooleanValidator and introduce a BooleanValueValidator, like
29
// in Flow, which won't be called on boolean action arguments.
30
'is'
=> array(NULL,
'Boolean value'
,
'boolean|string|integer'
)
31
);
32
33
44
public
function
isValid
($value) {
45
// see comment above, check if expectation is NULL, then nothing to do!
46
if
($this->options[
'is'
] === NULL) {
47
return
;
48
}
49
switch
(strtolower((
string
)$this->options[
'is'
])) {
50
case
'true'
:
51
case
'1'
:
52
$expectation = TRUE;
53
break
;
54
case
'false'
:
55
case
''
:
56
case
'0'
:
57
$expectation = FALSE;
58
break
;
59
default
:
60
$this->
addError
(
'The given expectation is not valid.'
, 1361959227);
61
return
;
62
}
63
64
if
($value !== $expectation) {
65
if
(!is_bool($value)) {
66
$this->
addError
(
'The given subject is not true.'
, 1361959230);
67
}
else
{
68
if
($expectation) {
69
$this->
addError
(
'The given subject is not true.'
, 1361959228);
70
}
else
{
71
$this->
addError
(
'The given subject is not false.'
, 1361959229);
72
}
73
}
74
}
75
}
76
77
}
TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator\$supportedOptions
$supportedOptions
Definition:
BooleanValidator.php:24
TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator\addError
addError($message, $code, array $arguments=array(), $title='')
Definition:
AbstractValidator.php:148
TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator
Definition:
BooleanValidator.php:19
TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator
Definition:
AbstractValidator.php:21
TYPO3\CMS\Extbase\Validation\Validator\BooleanValidator\isValid
isValid($value)
Definition:
BooleanValidator.php:44
TYPO3\CMS\Extbase\Validation\Validator
Definition:
AbstractCompositeValidator.php:2
typo3
sysext
extbase
Classes
Validation
Validator
BooleanValidator.php
Generated on Wed Aug 7 2019 09:52:25 for TYPO3 CMS by
1.8.13