TimeTravel::advanceSeconds()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace hamburgscleanest\GuzzleAdvancedThrottle;
4
5
use DateInterval;
6
7
trait TimeTravel
8
{
9 41
    private function _tick(int $value, string $unit = 'S'): self
10
    {
11 41
        $this->_now = $this->_now->add(new DateInterval('PT' . $value . $unit));
0 ignored issues
show
Bug Best Practice introduced by
The property _now does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
12
13 41
        return $this;
14
    }
15
16 37
    public function advanceSeconds(int $seconds): self
17
    {
18 37
        return $this->_tick($seconds, 'S');
19
    }
20
21 10
    public function advanceMinutes(int $minutes): self
22
    {
23 10
        return $this->_tick($minutes, 'M');
24
    }
25
}
26