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.
Passed
Push — develop ( d433ef...8d7806 )
by Baptiste
02:53
created

ServerFactory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
eloc 10
c 1
b 0
f 1
dl 0
loc 25
ccs 10
cts 12
cp 0.8333
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 3 1
A __construct() 0 3 1
A __invoke() 0 11 3
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Server\Status;
5
6
use Innmind\Server\Status\{
7
    Servers\OSX,
8
    Servers\Linux,
9
    Exception\UnsupportedOperatingSystem,
10
};
11
use Innmind\TimeContinuum\Clock;
12
13
final class ServerFactory
14
{
15
    private $clock;
16
17 3
    public function __construct(Clock $clock)
18
    {
19 3
        $this->clock = $clock;
20 3
    }
21
22 3
    public function __invoke(): Server
23
    {
24 3
        switch (\PHP_OS) {
25 3
            case 'Darwin':
26
                return new OSX($this->clock);
27
28 3
            case 'Linux':
29 3
                return new Linux($this->clock);
30
        }
31
32
        throw new UnsupportedOperatingSystem;
33
    }
34
35 3
    public static function build(Clock $clock): Server
36
    {
37 3
        return (new self($clock))();
38
    }
39
}
40