Passed
Push — master ( 0dbbcc...ef7bc0 )
by Nico
22:23 queued 12:47
created

TSpacecraftItem::getUserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
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 Stu\Module\Spacecraft\Lib;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Id;
9
use Doctrine\ORM\Mapping\MappedSuperclass;
10
use Doctrine\ORM\Query\ResultSetMapping;
11
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Stu\Component\Spacecraft\SpacecraftTypeEnum;
13
14
#[MappedSuperclass]
15
abstract class TSpacecraftItem implements TSpacecraftItemInterface
16
{
17
    #[Id]
18
    #[Column(type: 'integer')]
19
    private int $ship_id = 0;
20
21
    #[Column(type: 'integer', nullable: true)]
22
    private ?int $fleet_id = null;
23
24
    #[Column(type: 'integer')]
25
    private int $rump_id = 0;
26
27
    #[Column(type: 'integer', nullable: true)]
28
    private ?int $warp_state = null;
29
30
    #[Column(type: 'integer', nullable: true)]
31
    private ?int $tractor_warp_state = null;
32
33
    #[Column(type: 'integer', nullable: true)]
34
    private ?int $cloak_state = null;
35
36
    #[Column(type: 'integer', nullable: true)]
37
    private ?int $shield_state = null;
38
39
    #[Column(type: 'integer', nullable: true)]
40
    private ?int $uplink_state = null;
41
42
    #[Column(type: 'string')]
43
    private string $spacecraft_type = '';
44
45
    #[Column(type: 'string')]
46
    private string $ship_name = '';
47
48
    #[Column(type: 'integer')]
49
    private int $hull = 0;
50
51
    #[Column(type: 'integer')]
52
    private int $max_hull = 0;
53
54
    #[Column(type: 'integer')]
55
    private int $shield = 0;
56
57
    #[Column(type: 'integer', nullable: true)]
58
    private ?int $web_id = null;
59
60
    #[Column(type: 'integer', nullable: true)]
61
    private ?int $web_finish_time = null;
62
63
    #[Column(type: 'integer')]
64
    private int $user_id = 0;
65
66
    #[Column(type: 'string')]
67
    private string $user_name = '';
68
69
    #[Column(type: 'integer')]
70
    private int $rump_category_id = 0;
71
72
    #[Column(type: 'string')]
73
    private string $rump_name = '';
74
75
    #[Column(type: 'integer', nullable: true)]
76
    private ?int $rump_role_id = null;
77
78
    #[Column(type: 'boolean')]
79
    private bool $has_logbook = false;
80
81
    #[Column(type: 'boolean')]
82
    private bool $has_crew = false;
83
84 1
    #[Override]
85
    public function getShipId(): int
86
    {
87 1
        return $this->ship_id;
88
    }
89
90
    #[Override]
91
    public function getFleetId(): ?int
92
    {
93
        return $this->fleet_id;
94
    }
95
96 1
    #[Override]
97
    public function getRumpId(): int
98
    {
99 1
        return $this->rump_id;
100
    }
101
102 1
    #[Override]
103
    public function getWarpDriveState(): int
104
    {
105 1
        return $this->warp_state ?? 0;
106
    }
107
108 1
    #[Override]
109
    public function getTractorWarpState(): int
110
    {
111 1
        return $this->tractor_warp_state ?? 0;
112
    }
113
114 1
    #[Override]
115
    public function isCloaked(): int
116
    {
117 1
        return $this->cloak_state ?? 0;
118
    }
119
120 1
    #[Override]
121
    public function getShieldState(): int
122
    {
123 1
        return $this->shield_state ?? 0;
124
    }
125
126
    #[Override]
127
    public function getUplinkState(): int
128
    {
129
        return $this->uplink_state ?? 0;
130
    }
131
132 1
    #[Override]
133
    public function getType(): SpacecraftTypeEnum
134
    {
135 1
        return SpacecraftTypeEnum::from($this->spacecraft_type);
136
    }
137
138 1
    #[Override]
139
    public function getShipName(): string
140
    {
141 1
        return $this->ship_name;
142
    }
143
144 1
    #[Override]
145
    public function getHull(): int
146
    {
147 1
        return $this->hull;
148
    }
149
150 1
    #[Override]
151
    public function getMaxHull(): int
152
    {
153 1
        return $this->max_hull;
154
    }
155
156
    #[Override]
157
    public function getShield(): int
158
    {
159
        return $this->shield;
160
    }
161
162 1
    #[Override]
163
    public function getWebId(): ?int
164
    {
165 1
        return $this->web_id;
166
    }
167
168
    #[Override]
169
    public function getWebFinishTime(): ?int
170
    {
171
        return $this->web_finish_time;
172
    }
173
174 1
    #[Override]
175
    public function getUserId(): int
176
    {
177 1
        return $this->user_id;
178
    }
179
180 1
    #[Override]
181
    public function getUserName(): string
182
    {
183 1
        return $this->user_name;
184
    }
185
186 1
    #[Override]
187
    public function getRumpCategoryId(): int
188
    {
189 1
        return $this->rump_category_id;
190
    }
191
192 1
    #[Override]
193
    public function getRumpName(): string
194
    {
195 1
        return $this->rump_name;
196
    }
197
198
    #[Override]
199
    public function getRumpRoleId(): ?int
200
    {
201
        return $this->rump_role_id;
202
    }
203
204 1
    #[Override]
205
    public function hasLogbook(): bool
206
    {
207 1
        return $this->has_logbook;
208
    }
209
210 1
    #[Override]
211
    public function hasCrew(): bool
212
    {
213 1
        return $this->has_crew;
214
    }
215
216 1
    public static function addTSpacecraftItemFields(ResultSetMapping $rsm): void
217
    {
218 1
        $rsm->addFieldResult('s', 'shipid', 'ship_id');
219 1
        $rsm->addFieldResult('s', 'fleetid', 'fleet_id');
220 1
        $rsm->addFieldResult('s', 'rumpid', 'rump_id');
221 1
        $rsm->addFieldResult('s', 'warpstate', 'warp_state');
222 1
        $rsm->addFieldResult('s', 'tractorwarpstate', 'tractor_warp_state');
223 1
        $rsm->addFieldResult('s', 'cloakstate', 'cloak_state');
224 1
        $rsm->addFieldResult('s', 'shieldstate', 'shield_state');
225 1
        $rsm->addFieldResult('s', 'uplinkstate', 'uplink_state');
226 1
        $rsm->addFieldResult('s', 'spacecrafttype', 'spacecraft_type');
227 1
        $rsm->addFieldResult('s', 'shipname', 'ship_name');
228 1
        $rsm->addFieldResult('s', 'hull', 'hull');
229 1
        $rsm->addFieldResult('s', 'maxhull', 'max_hull');
230 1
        $rsm->addFieldResult('s', 'shield', 'shield');
231 1
        $rsm->addFieldResult('s', 'webid', 'web_id');
232 1
        $rsm->addFieldResult('s', 'webfinishtime', 'web_finish_time');
233 1
        $rsm->addFieldResult('s', 'userid', 'user_id');
234 1
        $rsm->addFieldResult('s', 'username', 'user_name');
235 1
        $rsm->addFieldResult('s', 'rumpcategoryid', 'rump_category_id');
236 1
        $rsm->addFieldResult('s', 'rumpname', 'rump_name');
237 1
        $rsm->addFieldResult('s', 'rumproleid', 'rump_role_id');
238 1
        $rsm->addFieldResult('s', 'haslogbook', 'has_logbook');
239 1
        $rsm->addFieldResult('s', 'hascrew', 'has_crew');
240
    }
241
}
242