Passed
Push — dev ( 5010f4...52d0f1 )
by Janko
07:47
created

VisualPanelEntryData   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 107
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 33
c 0
b 0
f 0
dl 0
loc 107
ccs 0
cts 33
cp 0
rs 10
wmc 18

15 Methods

Rating   Name   Duplication   Size   Complexity  
A getPosX() 0 3 1
A getShieldState() 0 3 1
A getDirection4Count() 0 3 1
A getFactionColor() 0 3 1
A getDirection1Count() 0 3 1
A getUserColor() 0 3 1
A getAllyColor() 0 3 1
A getMapfieldType() 0 3 1
A getPosY() 0 3 1
A getDirection2Count() 0 3 1
A getSystemId() 0 3 1
A hasCloakedShips() 0 3 1
A getShipCount() 0 3 1
A isSubspaceCodeAvailable() 0 6 4
A getDirection3Count() 0 3 1
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 getMapfieldType(): int
61
    {
62
        return $this->type;
63
    }
64
65
    public function getShipCount(): int
66
    {
67
        return $this->shipcount;
68
    }
69
70
    public function hasCloakedShips(): bool
71
    {
72
        return $this->cloakcount > 0;
73
    }
74
75
    public function getAllyColor(): ?string
76
    {
77
        return $this->allycolor;
78
    }
79
80
    public function getFactionColor(): ?string
81
    {
82
        return $this->factioncolor;
83
    }
84
85
    public function getUserColor(): ?string
86
    {
87
        return $this->usercolor;
88
    }
89
90
    public function getShieldState(): bool
91
    {
92
        return $this->shieldstate ?? false;
93
    }
94
95
    public function isSubspaceCodeAvailable(): bool
96
    {
97
        return $this->getDirection1Count() > 0
98
            || $this->getDirection2Count() > 0
99
            || $this->getDirection3Count() > 0
100
            || $this->getDirection4Count() > 0;
101
    }
102
103
    public function getDirection1Count(): int
104
    {
105
        return $this->d1c ?? 0;
106
    }
107
108
    public function getDirection2Count(): int
109
    {
110
        return $this->d2c ?? 0;
111
    }
112
113
    public function getDirection3Count(): int
114
    {
115
        return $this->d3c ?? 0;
116
    }
117
118
    public function getDirection4Count(): int
119
    {
120
        return $this->d4c ?? 0;
121
    }
122
}
123