TraceableCurrentIterator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A current() 0 8 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