TimeTravel   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A advanceMinutes() 0 3 1
A _tick() 0 5 1
A advanceSeconds() 0 3 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