Passed
Push — master ( 6b02b9...a180a6 )
by Nico
26:39 queued 18:43
created

VisualPanelEntryData::getDirection2Count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Lib\Map\VisualPanel;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\Id;
10
11
/**
12
 * @Entity
13
 */
14
class VisualPanelEntryData
15
{
16
    /** @Id @Column(type="integer") * */
17
    private int $posx = 0;
18
    /** @Id @Column(type="integer") * */
19
    private int $posy = 0;
20
    /** @Column(type="integer", nullable=true) * */
21
    private ?int $sysid = null;
22
    /** @Column(type="integer") * */
23
    private int $shipcount = 0;
24
    /** @Column(type="integer") * */
25
    private int $cloakcount = 0;
26
    /** @Column(type="string", nullable=true) * */
27
    private ?string $allycolor = null;
28
    /** @Column(type="string", nullable=true) * */
29
    private ?string $usercolor = null;
30
    /** @Column(type="string", nullable=true) * */
31
    private ?string $factioncolor = null;
32
    /** @Column(type="boolean", nullable=true) * */
33
    private ?bool $shieldstate = null;
34
    /** @Column(type="integer") * */
35
    private int $type = 0;
36
    /** @Column(type="integer", nullable=true) * */
37
    private ?int $d1c = null;
38
    /** @Column(type="integer", nullable=true) * */
39
    private ?int $d2c = null;
40
    /** @Column(type="integer", nullable=true) * */
41
    private ?int $d3c = null;
42
    /** @Column(type="integer", nullable=true) * */
43
    private ?int $d4c = null;
44
45
    public function getPosX(): int
46
    {
47
        return $this->posx;
48
    }
49
50
    public function getPosY(): int
51
    {
52
        return $this->posy;
53
    }
54
55
    public function getSystemId(): ?int
56
    {
57
        return $this->sysid;
58
    }
59
60
    public function setSystemId(int $systemId): VisualPanelEntryData
61
    {
62
        $this->sysid = $systemId;
63
64
        return $this;
65
    }
66
67
    public function getMapfieldType(): int
68
    {
69
        return $this->type;
70
    }
71
72
    public function setMapfieldType(int $type): VisualPanelEntryData
73
    {
74
        $this->type = $type;
75
76
        return $this;
77
    }
78
79
    public function getShipCount(): int
80
    {
81
        return $this->shipcount;
82
    }
83
84
    public function hasCloakedShips(): bool
85
    {
86
        return $this->cloakcount > 0;
87
    }
88
89
    public function getAllyColor(): ?string
90
    {
91
        return $this->allycolor;
92
    }
93
94
    public function getFactionColor(): ?string
95
    {
96
        return $this->factioncolor;
97
    }
98
99
    public function getUserColor(): ?string
100
    {
101
        return $this->usercolor;
102
    }
103
104
    public function getShieldState(): bool
105
    {
106
        return $this->shieldstate ?? false;
107
    }
108
109
    public function isSubspaceCodeAvailable(): bool
110
    {
111
        return $this->getDirection1Count() > 0
112
            || $this->getDirection2Count() > 0
113
            || $this->getDirection3Count() > 0
114
            || $this->getDirection4Count() > 0;
115
    }
116
117
    public function getDirection1Count(): int
118
    {
119
        return $this->d1c ?? 0;
120
    }
121
122
    public function getDirection2Count(): int
123
    {
124
        return $this->d2c ?? 0;
125
    }
126
127
    public function getDirection3Count(): int
128
    {
129
        return $this->d3c ?? 0;
130
    }
131
132
    public function getDirection4Count(): int
133
    {
134
        return $this->d4c ?? 0;
135
    }
136
}
137