Completed
Pull Request — master (#4)
by Pavel
10:02
created

ProfiledClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

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