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

ApplicationServerImpl::getVendor()   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
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