1 | <?php |
||
12 | class XFrameOptions extends Header |
||
13 | { |
||
14 | const TYPE = 'X-Frame-Options'; |
||
15 | const OPTIONS_DENY = 'Deny'; |
||
16 | const OPTIONS_SAME_ORIGIN = 'Sameorigin'; |
||
17 | const OPTIONS_ALLOW_FROM = 'ALLOW_FROM'; |
||
18 | const OPTIONS_ALLOW_FROM_URI_DEFAULT = '*'; |
||
19 | |||
20 | private $options = self::OPTIONS_DENY; |
||
21 | private $uri = [self::OPTIONS_ALLOW_FROM_URI_DEFAULT]; |
||
22 | |||
23 | |||
24 | /** |
||
25 | * XFrameOptions constructor. |
||
26 | * @param $options |
||
27 | * @param array $uri |
||
28 | */ |
||
29 | 1 | public function __construct($options = self::OPTIONS_DENY, array $uri = [self::OPTIONS_ALLOW_FROM_URI_DEFAULT]) |
|
33 | |||
34 | /** |
||
35 | * Value returned in the header |
||
36 | * @return string |
||
37 | */ |
||
38 | 4 | public function getValue() |
|
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | 2 | public function getOptions() |
|
58 | |||
59 | /** |
||
60 | * @param string $options |
||
61 | * @return $this |
||
62 | */ |
||
63 | 2 | public function setOptions($options = self::OPTIONS_DENY) |
|
68 | |||
69 | /** |
||
70 | * Returns allowed Uri |
||
71 | * @return array |
||
72 | */ |
||
73 | 3 | public function getUri() |
|
77 | |||
78 | /** |
||
79 | * Define list of url to be allowed |
||
80 | * @param string[] $uri |
||
81 | * @return $this |
||
82 | */ |
||
83 | 2 | public function setUri(array $uri = []) |
|
88 | |||
89 | /** |
||
90 | * Type for the header. Can be used to determine header to send |
||
91 | * @return string |
||
92 | */ |
||
93 | 2 | public function getType() |
|
97 | |||
98 | /** |
||
99 | * Displays the header |
||
100 | * @return Header |
||
101 | */ |
||
102 | 2 | public function render() |
|
106 | } |
||
107 |