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 | 11 | public function __call($name, $arguments) |
|
66 | |||
67 | public function __debugInfo() |
||
97 | |||
98 | /** |
||
99 | * Check if the jailed object is an instance of a given class. |
||
100 | * |
||
101 | * @param string $class |
||
102 | * |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function _coreInstanceOf($class) |
||
109 | |||
110 | /// |
||
111 | // ArrayAccess Implementation |
||
112 | /// |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | 22 | public function offsetExists($offset) |
|
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | 32 | public function offsetGet($offset) |
|
129 | |||
130 | /** |
||
131 | * {@inheritdoc} |
||
132 | */ |
||
133 | public function offsetSet($offset, $value) |
||
137 | |||
138 | /** |
||
139 | * {@inheritdoc} |
||
140 | */ |
||
141 | public function offsetUnset($offset) |
||
145 | |||
146 | /// |
||
147 | // IteratorAggregate implementation |
||
148 | /// |
||
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | 19 | public function getIterator() |
|
157 | |||
158 | /// |
||
159 | // JsonSerializable implementation |
||
160 | /// |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | public function jsonSerialize() |
||
169 | } |
||
170 |
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.