1 | <?php |
||
6 | class XFrameOptions extends Header |
||
7 | { |
||
8 | const TYPE = 'X-Frame-Options'; |
||
9 | |||
10 | const OPTIONS_DENY = 'Deny'; |
||
11 | const OPTIONS_SAMEORIGIN = 'Sameorigin'; |
||
12 | const OPTIONS_ALLOW_FROM = 'ALLOW_FROM'; |
||
13 | const OPTIONS_ALLOW_FROM_URI_DEFAULT = '*'; |
||
14 | |||
15 | private $options = self::OPTIONS_DENY; |
||
16 | private $uri = self::OPTIONS_DENY; |
||
17 | |||
18 | /** |
||
19 | * @param bool $options |
||
20 | */ |
||
21 | public function __construct($options,$uri = array()) |
||
26 | |||
27 | public function setOptions($options){ |
||
31 | |||
32 | public function getOptions(){ |
||
35 | |||
36 | |||
37 | public function setURI($uri) |
||
42 | |||
43 | public function getURI() |
||
50 | |||
51 | /** |
||
52 | * Value returned in the header |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getValue() |
||
68 | |||
69 | /** |
||
70 | * Type for the header. Can be used to determine header to send |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getType() |
||
77 | } |
||
78 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and
&&
or
||
The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&
, or||
.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
die
introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrow
at this point:These limitations lead to logical operators rarely being of use in current PHP code.