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

TraceableCurrentIterator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
namespace ScayTrase\Api\Rpc\Decorators;
4
5
use Symfony\Component\Stopwatch\Stopwatch;
6
use Traversable;
7
8
final class TraceableCurrentIterator extends \IteratorIterator
9
{
10
    /** @var Stopwatch */
11
    private $stopwatch;
12
    /** @var string */
13
    private $client;
14
15 1
    public function __construct(Traversable $iterator, Stopwatch $stopwatch, $client)
16
    {
17 1
        parent::__construct($iterator);
18 1
        $this->stopwatch = $stopwatch;
19 1
        $this->client    = $client;
20 1
    }
21
22 1
    public function current()
23
    {
24 1
        $this->stopwatch->start($this->client, TraceableClient::CATEGORY_RESPONSE);
25 1
        $value = parent::current();
26 1
        $this->stopwatch->stop($this->client);
27
28 1
        return $value;
29
    }
30
}
31