Passed
Push — master ( 017b89...6bcf74 )
by Fabian
18:54 queued 03:47
created

FakeClock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A microtime() 0 3 1
A __construct() 0 3 1
A advanceMillis() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace IntegerNet\DeployerTimer;
5
6
class FakeClock implements Clock
7
{
8
    /**
9
     * @var float
10
     */
11
    private $timestamp;
12
13 8
    public function __construct(float $timestamp)
14
    {
15 8
        $this->timestamp = $timestamp;
16 8
    }
17
18 8
    public function microtime(): float
19
    {
20 8
        return $this->timestamp;
21
    }
22
23 5
    public function advanceMillis(int $millis): void
24
    {
25 5
        $this->timestamp += ($millis * 0.001);
26 5
    }
27
}
28