Completed
Push — master ( 293a61...e1a0d3 )
by
unknown
12s
created

Stopwatch::stop()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace MovingImage\Bundle\VMProApiBundle\Service;
4
5
use MovingImage\Client\VMPro\Interfaces\StopwatchInterface;
6
use Symfony\Component\Stopwatch\Stopwatch as SymfonyStopwatch;
7
use Symfony\Component\Stopwatch\StopwatchEvent;
8
9
/**
10
 * Adapter for Symfony Stopwatch, implementing the StopwatchInterface.
11
 */
12
class Stopwatch implements StopwatchInterface
13
{
14
    /**
15
     * @var SymfonyStopwatch
16
     */
17
    private $delegate;
18
19
    /**
20
     * @var StopwatchEvent[]
21
     */
22
    private $events = [];
23
24
    /**
25
     * @param SymfonyStopwatch $delegate
26
     */
27 4
    public function __construct(SymfonyStopwatch $delegate)
28
    {
29 4
        $this->delegate = $delegate;
30 4
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 4
    public function start($name, $category = null)
36
    {
37 4
        $this->delegate->start($name, $category);
38 4
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 4
    public function stop($name)
44
    {
45 4
        $this->events[$name] = $this->delegate->stop($name);
46 4
    }
47
48
    /**
49
     * @return StopwatchEvent[]
50
     */
51 2
    public function getEvents()
52
    {
53 2
        return $this->events;
54
    }
55
}
56