Completed
Push — master ( f86d9b...1814a7 )
by Pavel
02:54
created

ProfiledClient::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 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 1
    {
29 2
        $this->profiler->registerCalls($calls);
30
31 2
        return new ProfiledResponseCollection($this->client->invoke($calls), $this->profiler);
32
    }
33
}
34