1 | <?php |
||
16 | class JailedDocument implements \ArrayAccess |
||
17 | { |
||
18 | /** |
||
19 | * @var string[] |
||
20 | */ |
||
21 | private $whiteListFunctions; |
||
22 | |||
23 | /** |
||
24 | * @var string[] |
||
25 | */ |
||
26 | private $jailedFunctions; |
||
27 | |||
28 | /** |
||
29 | * @var JailedDocumentInterface |
||
30 | */ |
||
31 | private $object; |
||
32 | |||
33 | /** |
||
34 | * JailObject constructor. |
||
35 | * |
||
36 | * @param JailedDocumentInterface $object The object that will be jailed |
||
37 | * @param array $whiteListFunctions A list of function names that can be called |
||
38 | * @param array $jailedFunctions |
||
39 | */ |
||
40 | 49 | public function __construct(&$object, array $whiteListFunctions, array $jailedFunctions = array()) |
|
51 | |||
52 | 10 | public function __call($name, $arguments) |
|
74 | |||
75 | 4 | public function coreInstanceOf($class) |
|
79 | |||
80 | // |
||
81 | // ArrayAccess Implementation |
||
82 | // |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | 22 | public function offsetExists($offset) |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 30 | public function offsetGet($offset) |
|
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | public function offsetSet($offset, $value) |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | public function offsetUnset($offset) |
||
115 | } |
||
116 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.