TYPO3CMS
9.5
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
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
JsConfirmation.php
Go to the documentation of this file.
1
<?php
2
namespace
TYPO3\CMS\Core\Type\Bitmask
;
3
4
/*
5
* This file is part of the TYPO3 CMS project.
6
*
7
* It is free software; you can redistribute it and/or modify it under
8
* the terms of the GNU General Public License, either version 2
9
* of the License, or any later version.
10
*
11
* For the full copyright and license information, please read the
12
* LICENSE.txt file that was distributed with this source code.
13
*
14
* The TYPO3 project - inspiring people to share!
15
*/
16
17
use
TYPO3\CMS\Core\Type\Enumeration
;
18
use
TYPO3\CMS\Core\Type\Exception
;
19
23
final
class
JsConfirmation
extends
Enumeration
24
{
28
const
TYPE_CHANGE
= 0b00000001;
29
33
const
COPY_MOVE_PASTE
= 0b00000010;
34
38
const
DELETE
= 0b00000100;
39
43
const
FE_EDIT
= 0b00001000;
44
48
const
OTHER
= 0b10000000;
49
53
const
ALL
= 255;
54
58
const
__default
=
self::ALL
;
59
65
protected
static
$allowedValues
= self::TYPE_CHANGE | self::COPY_MOVE_PASTE | self::DELETE | self::FE_EDIT |
self::OTHER
;
66
73
public
function
matches
(
JsConfirmation
$value
)
74
{
75
$value
= (int)(
string
)
$value
;
76
$thisValue = (int)(
string
)$this;
77
78
return
(
$value
& $thisValue) == $thisValue;
79
}
80
88
protected
function
setValue
(
$value
)
89
{
90
if
($this->
isValid
(
$value
)) {
91
$this->value =
$value
;
92
}
else
{
93
parent::setValue(
$value
);
94
}
95
}
96
103
protected
function
isValid
(
$value
)
104
{
105
if
(
$value
< 255) {
106
// Check for combined bitmask or bitmask with bits unset from self::ALL
107
$unsetValues = (self::ALL ^
$value
);
108
return
(
$value
& self::$allowedValues) ===
$value
|| $unsetValues === ($unsetValues &
self::$allowedValues
);
109
}
110
return
parent::isValid(
$value
);
111
}
112
}
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\matches
bool matches(JsConfirmation $value)
Definition:
JsConfirmation.php:72
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\__default
const __default
Definition:
JsConfirmation.php:58
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\setValue
setValue($value)
Definition:
JsConfirmation.php:87
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\COPY_MOVE_PASTE
const COPY_MOVE_PASTE
Definition:
JsConfirmation.php:33
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\FE_EDIT
const FE_EDIT
Definition:
JsConfirmation.php:43
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\isValid
bool isValid($value)
Definition:
JsConfirmation.php:102
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\DELETE
const DELETE
Definition:
JsConfirmation.php:38
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\OTHER
const OTHER
Definition:
JsConfirmation.php:48
TYPO3\CMS\Core\Type\Exception
Definition:
InvalidEnumerationDefinitionException.php:2
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\ALL
const ALL
Definition:
JsConfirmation.php:53
TYPO3\CMS\Core\Type\Enumeration\$value
mixed $value
Definition:
Enumeration.php:28
TYPO3\CMS\Core\Type\Enumeration
Definition:
Enumeration.php:25
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\TYPE_CHANGE
const TYPE_CHANGE
Definition:
JsConfirmation.php:28
TYPO3\CMS\Core\Type\Bitmask
Definition:
JsConfirmation.php:2
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation
Definition:
JsConfirmation.php:24
TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\$allowedValues
static int $allowedValues
Definition:
JsConfirmation.php:64
doxygen
typo3
sysext
core
Classes
Type
Bitmask
JsConfirmation.php
Generated on Tue Oct 5 2021 01:57:14 for TYPO3CMS by
1.8.18