Passed
Push — master ( a4ffc4...615af5 )
by Alexander
03:23
created

ServiceProxy   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 69.23%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 35
ccs 9
cts 13
cp 0.6923
rs 10
wmc 5

5 Methods

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