| Total Complexity | 6 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Proxy |
||
| 8 | { |
||
| 9 | /** @var object */ |
||
| 10 | private $target; |
||
| 11 | |||
| 12 | /** @var array */ |
||
| 13 | private $events; |
||
| 14 | |||
| 15 | 9 | public function __construct($target, array $events = []) |
|
| 19 | 9 | } |
|
| 20 | |||
| 21 | 7 | public function __call($name, $arguments) |
|
| 22 | { |
||
| 23 | 7 | if ($this->isMuted($name)) { |
|
| 24 | 5 | return null; |
|
| 25 | } |
||
| 26 | |||
| 27 | 4 | if (method_exists($this->target, $name)) { |
|
| 28 | 3 | return $this->target->$name(...$arguments); |
|
| 29 | } |
||
| 30 | |||
| 31 | 1 | throw new BadMethodCallException(sprintf( |
|
| 32 | 1 | 'Unknown method [%s@%s]', |
|
| 33 | 1 | get_class($this->target), |
|
| 34 | $name |
||
| 35 | )); |
||
| 36 | } |
||
| 37 | |||
| 38 | 7 | protected function isMuted($name): bool |
|
| 41 | } |
||
| 42 | } |
||
| 43 |