1 | <?php |
||
15 | class JailedDocument implements \ArrayAccess, \IteratorAggregate, \JsonSerializable |
||
16 | { |
||
17 | /** @var string[] */ |
||
18 | private $whiteListFunctions; |
||
19 | |||
20 | /** @var string[] */ |
||
21 | private $jailedFunctions; |
||
22 | |||
23 | /** @var TemplateReadyDocument */ |
||
24 | private $object; |
||
25 | |||
26 | /** @var array */ |
||
27 | private $debugInfo; |
||
28 | |||
29 | /** |
||
30 | * JailObject constructor. |
||
31 | * |
||
32 | * @param TemplateReadyDocument $object the object that will be jailed |
||
33 | * @param array $whiteListFunctions a list of function names that can be called |
||
34 | * @param array $jailedFunctions a list of functions that will be redirected to another function |
||
35 | */ |
||
36 | 53 | public function __construct(TemplateReadyDocument &$object, array $whiteListFunctions, array $jailedFunctions = []) |
|
43 | |||
44 | 12 | public function __call($name, $arguments) |
|
66 | |||
67 | 1 | public function __debugInfo() |
|
97 | |||
98 | 1 | public function __toString() |
|
104 | |||
105 | /** |
||
106 | * Check if the jailed object is an instance of a given class. |
||
107 | * |
||
108 | * @param string $class |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | public function _coreInstanceOf($class) |
||
116 | |||
117 | /// |
||
118 | // ArrayAccess Implementation |
||
119 | /// |
||
120 | |||
121 | /** |
||
122 | * {@inheritdoc} |
||
123 | */ |
||
124 | 22 | public function offsetExists($offset) |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 32 | public function offsetGet($offset) |
|
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | */ |
||
140 | public function offsetSet($offset, $value) |
||
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | public function offsetUnset($offset) |
||
152 | |||
153 | /// |
||
154 | // IteratorAggregate implementation |
||
155 | /// |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | 1 | public function getIterator() |
|
164 | |||
165 | /// |
||
166 | // JsonSerializable implementation |
||
167 | /// |
||
168 | |||
169 | /** |
||
170 | * {@inheritdoc} |
||
171 | */ |
||
172 | public function jsonSerialize() |
||
176 | } |
||
177 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.