Test Failed
Push — main ( d01f4c...5af89f )
by Bingo
15:56
created

ApplicationServerImpl   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 12
dl 0
loc 37
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getVersion() 0 3 1
A setVersion() 0 3 1
A __toString() 0 5 1
A getVendor() 0 3 1
A setVendor() 0 3 1
A __construct() 0 4 3
1
<?php
2
3
namespace Jabe\Engine\Impl\Telemetry\Dto;
4
5
use Jabe\Engine\Impl\Util\ParseUtil;
6
use Jabe\Engine\Telemetry\ApplicationServerInterface;
7
8
class ApplicationServerImpl implements ApplicationServerInterface
9
{
10
    protected $vendor;
11
    protected $version;
12
13
    public function __construct(string $vendorOrVersion, string $version = null)
14
    {
15
        $this->vendor = $version == null ? ParseUtil::parseServerVendor($vendorOrVersion) : $vendorOrVersion;
0 ignored issues
show
Bug introduced by
It seems like you are loosely comparing $version of type null|string against null; this is ambiguous if the string can be empty. Consider using a strict comparison === instead.
Loading history...
16
        $this->version = $version == null ? $vendorOrVersion : $version;
0 ignored issues
show
Bug introduced by
It seems like you are loosely comparing $version of type null|string against null; this is ambiguous if the string can be empty. Consider using a strict comparison === instead.
Loading history...
17
    }
18
19
    public function __toString()
20
    {
21
        return json_encode([
22
            'vendor' => $this->vendor,
23
            'version' => $this->version
24
        ]);
25
    }
26
27
    public function getVendor(): string
28
    {
29
        return $this->vendor;
30
    }
31
32
    public function setVendor(string $vendor): void
33
    {
34
        $this->vendor = $vendor;
35
    }
36
37
    public function getVersion(): string
38
    {
39
        return $this->version;
40
    }
41
42
    public function setVersion(string $version): void
43
    {
44
        $this->version = $version;
45
    }
46
}
47