| Total Complexity | 4 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 66.67% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class ServiceMethodProxy extends ServiceProxy |
||
| 10 | { |
||
| 11 | private array $methods; |
||
| 12 | |||
| 13 | 2 | public function __construct( |
|
| 14 | string $service, |
||
| 15 | object $instance, |
||
| 16 | array $methods, |
||
| 17 | ContainerProxyConfig $config |
||
| 18 | ) { |
||
| 19 | 2 | $this->methods = $methods; |
|
| 20 | 2 | parent::__construct($service, $instance, $config); |
|
| 21 | } |
||
| 22 | |||
| 23 | 1 | protected function afterCall(string $methodName, array $arguments, mixed $result, float $timeStart): mixed |
|
| 24 | { |
||
| 25 | try { |
||
| 26 | 1 | if (isset($this->methods[$methodName])) { |
|
| 27 | $callback = $this->methods[$methodName]; |
||
| 28 | $result = $callback($result, ...$arguments); |
||
| 29 | } |
||
| 30 | 1 | } finally { |
|
| 31 | 1 | $this->logProxy($this->getService(), $this->getInstance(), $methodName, $arguments, $result, $timeStart); |
|
| 32 | } |
||
| 33 | |||
| 34 | 1 | return $result; |
|
| 35 | } |
||
| 36 | |||
| 37 | protected function getNewStaticInstance(object $instance): ObjectProxy |
||
| 40 | } |
||
| 41 | } |
||
| 42 |