Target::getGermStyle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PanicLabCore\Structs;
6
7
use function get_object_vars;
8
9
class Target implements \JsonSerializable
10
{
11
    /** @var string */
12
    protected $germColor;
13
14
    /** @var string */
15
    protected $germSize;
16
17
    /** @var string */
18
    protected $germStyle;
19
20 37
    public function __construct(string $germColor, string $germSize, string $germStyle)
21
    {
22 37
        $this->germColor = $germColor;
23 37
        $this->germSize = $germSize;
24 37
        $this->germStyle = $germStyle;
25 37
    }
26
27 7
    public function setGermColor(string $germColor): void
28
    {
29 7
        $this->germColor = $germColor;
30 7
    }
31
32 6
    public function setGermSize(string $germSize): void
33
    {
34 6
        $this->germSize = $germSize;
35 6
    }
36
37 4
    public function setGermStyle(string $germStyle): void
38
    {
39 4
        $this->germStyle = $germStyle;
40 4
    }
41
42 19
    public function getGermColor(): string
43
    {
44 19
        return $this->germColor;
45
    }
46
47 19
    public function getGermSize(): string
48
    {
49 19
        return $this->germSize;
50
    }
51
52 16
    public function getGermStyle(): string
53
    {
54 16
        return $this->germStyle;
55
    }
56
57 14
    public function checkIfSame(GermTile $tile): bool
58
    {
59 14
        if ($tile->getColor() !== $this->getGermColor()) {
60 6
            return false;
61
        }
62
63 12
        if ($tile->getSize() !== $this->getGermSize()) {
64 4
            return false;
65
        }
66
67 11
        return $tile->getStyle() === $this->getGermStyle();
68
    }
69
70
    /**
71
     * @return string[]
72
     */
73 1
    public function jsonSerialize(): array
74
    {
75 1
        return get_object_vars($this);
76
    }
77
}
78