Completed
Push — master ( 53214f...7b5764 )
by Kamil
03:10
created

ReactTimer   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __destruct() 0 4 1
A getActualTimer() 0 4 1
A getLoop() 0 4 1
A getInterval() 0 4 1
A getCallback() 0 4 1
A setData() 0 4 1
A getData() 0 4 1
A isPeriodic() 0 4 1
A isActive() 0 4 1
A cancel() 0 4 1
1
<?php
2
3
namespace Dazzle\Loop\Bridge\React;
4
5
use Dazzle\Loop\Timer\TimerInterface;
6
7
class ReactTimer implements ReactTimerInterface
8
{
9
    /**
10
     * @var TimerInterface
11
     */
12
    protected $timer;
13
14
    /**
15
     * @param TimerInterface $timer
16
     */
17 15
    public function __construct(TimerInterface $timer)
18
    {
19 15
        $this->timer = $timer;
20 15
    }
21
22
    /**
23
     *
24
     */
25 15
    public function __destruct()
26
    {
27 15
        unset($this->timer);
28 15
    }
29
30
    /**
31
     * @override
32
     * @inheritDoc
33
     */
34 1
    public function getActualTimer()
35
    {
36 1
        return $this->timer;
37
    }
38
39
    /**
40
     * @override
41
     * @inheritDoc
42
     */
43 1
    public function getLoop()
44
    {
45 1
        return new ReactLoop($this->timer->getLoop());
46
    }
47
48
    /**
49
     * @override
50
     * @inheritDoc
51
     */
52 1
    public function getInterval()
53
    {
54 1
        return $this->timer->getInterval();
55
    }
56
57
    /**
58
     * @override
59
     * @inheritDoc
60
     */
61 1
    public function getCallback()
62
    {
63 1
        return $this->timer->getCallback();
64
    }
65
66
    /**
67
     * @override
68
     * @inheritDoc
69
     */
70 1
    public function setData($data)
71
    {
72 1
        return $this->timer->setData($data);
73
    }
74
75
    /**
76
     * @override
77
     * @inheritDoc
78
     */
79 1
    public function getData()
80
    {
81 1
        return $this->timer->getData();
82
    }
83
84
    /**
85
     * @override
86
     * @inheritDoc
87
     */
88 2
    public function isPeriodic()
89
    {
90 2
        return $this->timer->isPeriodic();
91
    }
92
93
    /**
94
     * @override
95
     * @inheritDoc
96
     */
97 2
    public function isActive()
98
    {
99 2
        return $this->timer->isActive();
100
    }
101
102
    /**
103
     * @override
104
     * @inheritDoc
105
     */
106 1
    public function cancel()
107
    {
108 1
        $this->timer->cancel();
109 1
    }
110
}
111