GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 2352be...4fa160 )
by Baptiste
03:32 queued 59s
created

CacheLoadAverage::processes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Server\Status\Servers\Decorator;
5
6
use Innmind\Server\Status\{
7
    Server,
8
    Server\Cpu,
9
    Server\Memory,
10
    Server\Processes,
11
    Server\LoadAverage,
12
    Server\Disk
13
};
14
use Innmind\TimeContinuum\{
15
    TimeContinuumInterface,
16
    ElapsedPeriod
17
};
18
use Innmind\Url\PathInterface;
19
20
final class CacheLoadAverage implements Server
21
{
22
    private $server;
23
    private $clock;
24
    private $threshold;
25
    private $cachedAt;
26
    private $data;
27
28
    public function __construct(
29
        Server $server,
30
        TimeContinuumInterface $clock,
31
        ElapsedPeriod $threshold
32
    ) {
33
        $this->server = $server;
34
        $this->clock = $clock;
35
        $this->threshold = $threshold;
36
    }
37
38
    public function cpu(): Cpu
39
    {
40
        return $this->server->cpu();
41
    }
42
43
    public function memory(): Memory
44
    {
45
        return $this->server->memory();
46
    }
47
48
    public function processes(): Processes
49
    {
50
        return $this->server->processes();
51
    }
52
53
    public function loadAverage(): LoadAverage
54
    {
55
        $now = $this->clock->now();
56
57
        if (
58
            $this->cachedAt &&
59
            $this->threshold->longerThan(
60
                $now->elapsedSince($this->cachedAt)
61
            )
62
        ) {
63
            return $this->data;
64
        }
65
66
        $this->data = $this->server->loadAverage();
67
        $this->cachedAt = $now;
68
69
        return $this->data;
70
    }
71
72
    public function disk(): Disk
73
    {
74
        return $this->server->disk();
75
    }
76
77
    public function tmp(): PathInterface
78
    {
79
        return $this->server->tmp();
80
    }
81
}
82