Completed
Pull Request — master (#22)
by De Cramer
02:13
created

TimerDataProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0
ccs 0
cts 12
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A onRun() 0 4 1
A onPreLoop() 0 9 2
A onPostLoop() 0 4 1
1
<?php
2
3
namespace eXpansion\Core\DataProviders;
4
5
class TimerDataProvider extends AbstractDataProvider
6
{
7
8
    protected $time = 0;
9
10
    public function onRun()
11
    {
12
13
    }
14
15
    public function onPreLoop()
16
    {
17
        $this->dispatch(__FUNCTION__, []);
18
19
        if ($this->time != time()) {
20
            $this->dispatch("onEverySecond", []);
21
            $this->time = time();
22
        }
23
    }
24
25
26
    public function onPostLoop()
27
    {
28
        $this->dispatch(__FUNCTION__, []);
29
    }
30
31
}
32
33