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

ProfiledClient::invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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