ProfiledClient   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A invoke() 0 6 1
1
<?php
2
3
namespace ScayTrase\Api\Rpc\Decorators;
4
5
use ScayTrase\Api\Rpc\RpcClientInterface;
6
7
final class ProfiledClient implements RpcClientInterface
8
{
9
    /** @var  RpcClientInterface */
10
    private $client;
11
    /** @var  ProfiledClientStorage */
12
    private $profiler;
13
14
    /**
15
     * ProfiledClient constructor.
16
     *
17
     * @param RpcClientInterface $client
18
     * @param ProfiledClientStorage        $profiler
19
     */
20 2
    public function __construct(RpcClientInterface $client, ProfiledClientStorage $profiler)
21
    {
22 2
        $this->client   = $client;
23 2
        $this->profiler = $profiler;
24 2
    }
25
26
    /** {@inheritdoc} */
27 2
    public function invoke($calls)
28
    {
29 2
        $this->profiler->registerCalls($calls);
30
31 2
        return new ProfiledResponseCollection($this->client->invoke($calls), $this->profiler);
32
    }
33
}
34