Test Failed
Pull Request — master (#133)
by Rustam
03:14
created

ServiceProxy::afterCall()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Collector;
6
7
use Yiisoft\Proxy\ObjectProxy;
8
9
class ServiceProxy extends ObjectProxy
10
{
11
    use ProxyLogTrait;
12
13
    private string $service;
14
15
    public function __construct(
16
        string $service,
17
        object $instance,
18
        ContainerProxyConfig $config
19
    ) {
20
        $this->service = $service;
21
        $this->config = $config;
22
        parent::__construct($instance);
23
    }
24
25
    protected function afterCall(string $methodName, array $arguments, mixed $result, float $timeStart): mixed
26
    {
27
        $this->logProxy($this->service, $this->getInstance(), $methodName, $arguments, $result, $timeStart);
28
        return $result;
29
    }
30
31
    protected function getNewStaticInstance(object $instance): ObjectProxy
32
    {
33
        return new static($this->service, $instance, $this->config);
34
    }
35
36
    protected function getService(): string
37
    {
38
        return $this->service;
39
    }
40
41
    protected function getConfig(): ContainerProxyConfig
42
    {
43
        return $this->config;
44
    }
45
}
46