SystemClock   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 7
c 1
b 0
f 1
dl 0
loc 24
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A now() 0 3 1
A create() 0 3 1
A fromTimestamp() 0 3 1
1
<?php
2
3
namespace hamburgscleanest\GuzzleAdvancedThrottle;
4
5
use DateTimeImmutable;
6
7
class SystemClock
8
{
9
    use TimeTravel;
10
11
    private DateTimeImmutable $_now;
12
13 44
    public function __construct(DateTimeImmutable | null $now = null)
0 ignored issues
show
Bug introduced by
The type hamburgscleanest\GuzzleAdvancedThrottle\null was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
    {
15 44
        $this->_now = $now ?? new DateTimeImmutable();
16 44
    }
17
18 42
    public static function create(DateTimeImmutable | null $now = null): self
19
    {
20 42
        return new self($now);
21
    }
22
23 25
    public static function fromTimestamp(int $timestamp): self
24
    {
25 25
        return new self((new DateTimeImmutable())->setTimestamp($timestamp));
26
    }
27
28 44
    public function now(): DateTimeImmutable
29
    {
30 44
        return $this->_now;
31
    }
32
}
33