TimeStrategy::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace whm\Smoke\Extensions\SmokeStop\Strategy;
4
5
class TimeStrategy
6
{
7
    private $duration;
8
    private $startTime;
9
10
    public function init($duration)
11
    {
12
        $this->duration = $duration;
13
    }
14
15
    /**
16
     * @Event("Scanner.Scan.Begin")
17
     */
18
    public function startTimer()
19
    {
20
        $this->startTime = time();
21
    }
22
23
    public function isStopped()
24
    {
25
        return ($this->startTime + $this->duration) < time();
26
    }
27
}
28