| Total Complexity | 6 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 66.67% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class Proxy |
||
| 8 | { |
||
| 9 | private object $proxied; |
||
| 10 | private ProxyHandlerInterface $handler; |
||
| 11 | |||
| 12 | 4 | public function __construct(object $proxied, ProxyHandlerInterface $handler) |
|
| 13 | { |
||
| 14 | 4 | $this->proxied = $proxied; |
|
| 15 | 4 | $this->handler = $handler; |
|
| 16 | 4 | } |
|
| 17 | |||
| 18 | 1 | public function __get(string $name) |
|
| 19 | { |
||
| 20 | 1 | $this->handler->onGet($name, $this->proxied); |
|
| 21 | 1 | return $this->proxied->$name; |
|
| 22 | } |
||
| 23 | |||
| 24 | 1 | public function __set(string $name, $value) |
|
| 25 | { |
||
| 26 | 1 | $this->handler->onSet($name, $value, $this->proxied); |
|
| 27 | 1 | $this->proxied->$name = $value; |
|
| 28 | 1 | } |
|
| 29 | |||
| 30 | public function __isset(string $name) |
||
| 31 | { |
||
| 32 | $this->handler->onIsset($name); |
||
|
|
|||
| 33 | return isset($this->proxied->$name); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function __unset(string $name) |
||
| 40 | } |
||
| 41 | |||
| 42 | 2 | public function __call(string $name, array $arguments) |
|
| 43 | { |
||
| 44 | 2 | $this->handler->onCall($name, $arguments, $this->proxied); |
|
| 48 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.