Passed
Pull Request — master (#1969)
by Janko
22:34 queued 10:03
created

SpacecraftRump   F

Complexity

Total Complexity 92

Size/Duplication

Total Lines 743
Duplicated Lines 0 %

Test Coverage

Coverage 32.12%

Importance

Changes 0
Metric Value
eloc 323
dl 0
loc 743
ccs 71
cts 221
cp 0.3212
rs 2
c 0
b 0
f 0
wmc 92

90 Methods

Rating   Name   Duplication   Size   Complexity  
A getSort() 0 4 1
A getPhaserShieldDamageFactor() 0 4 1
A getIsNpc() 0 4 1
A setIsBuildable() 0 5 1
A getFlightEcost() 0 4 1
A getCommodityId() 0 4 1
A getStorage() 0 4 1
A getPrestige() 0 4 1
A getBaseEps() 0 4 1
A getName() 0 4 1
A setFlightEcost() 0 5 1
A getBeamFactor() 0 4 1
A getFractionId() 0 5 1
A setCommodityId() 0 5 1
A setBaseTorpedoStorage() 0 5 1
A setBaseHull() 0 5 1
A getTractorMass() 0 4 1
A getStartHangar() 0 4 1
A getHitChance() 0 4 1
A getBaseHull() 0 4 1
A getSpecialSlots() 0 4 1
A setTorpedoLevel() 0 5 1
A setRoleId() 0 5 1
A setBaseReactor() 0 5 1
A getSpecialAbilities() 0 4 1
A getIsBuildable() 0 4 1
A getNpcBuildable() 0 4 1
A setSpecialSlots() 0 5 1
A getCategoryId() 0 4 1
A getBaseDamage() 0 4 1
A getId() 0 4 1
A getRoleId() 0 4 1
A isEscapePods() 0 4 1
A setCategoryId() 0 6 1
A setShipRumpCategory() 0 5 1
A getEpsCost() 0 4 1
A setBuildtime() 0 5 1
A getPhaserVolleys() 0 4 1
A getShipRumpRole() 0 4 1
A getBuildtime() 0 4 1
A setPhaserHullDamageFactor() 0 5 1
A setDockingSlots() 0 5 1
A setBaseDamage() 0 5 1
A getDatabaseEntry() 0 4 1
A setCommodity() 0 5 1
A getEvadeChance() 0 4 1
A setBaseCrew() 0 5 1
A setSort() 0 5 1
A setBaseSensorRange() 0 5 1
A isWorkbee() 0 6 2
A setEpsCost() 0 5 1
A __construct() 0 5 1
A setPhaserVolleys() 0 5 1
A getShuttleSlots() 0 4 1
A getBuildingCosts() 0 4 1
A getTorpedoVolleys() 0 4 1
A setDatabaseEntry() 0 5 1
A setBeamFactor() 0 5 1
A getNeededWorkbees() 0 4 1
A isShipyard() 0 5 2
A hasSpecialAbility() 0 4 1
A getShipRumpCategory() 0 4 1
A getPhaserHullDamageFactor() 0 4 1
A getBaseSensorRange() 0 4 1
A setBaseShield() 0 5 1
A getTorpedoLevel() 0 4 1
A getBaseWarpDrive() 0 4 1
A setIsNpc() 0 5 1
A setEvadeChance() 0 5 1
A getNeededRepairWorkbees() 0 4 1
A getBaseReactor() 0 4 1
A setNpcBuildable() 0 5 1
A setShuttleSlots() 0 5 1
A setBaseWarpDrive() 0 5 1
A getBaseTorpedoStorage() 0 4 1
A getModuleLevel() 0 4 1
A getTractorPayload() 0 4 1
A getDockingSlots() 0 4 1
A setPhaserShieldDamageFactor() 0 5 1
A setBaseEps() 0 5 1
A setStorage() 0 5 1
A getBaseCrew() 0 4 1
A setTorpedoVolleys() 0 5 1
A setModuleLevel() 0 5 1
A getCommodity() 0 4 1
A setShipRumpRole() 0 5 1
A setHitChance() 0 5 1
A getDatabaseId() 0 4 1
A getBaseShield() 0 4 1
A setName() 0 5 1

How to fix   Complexity   

Complex Class

Complex classes like SpacecraftRump often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use SpacecraftRump, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\Common\Collections\ArrayCollection;
8
use Doctrine\Common\Collections\Collection;
9
use Doctrine\ORM\Mapping\Column;
10
use Doctrine\ORM\Mapping\Entity;
11
use Doctrine\ORM\Mapping\GeneratedValue;
12
use Doctrine\ORM\Mapping\Id;
13
use Doctrine\ORM\Mapping\Index;
14
use Doctrine\ORM\Mapping\JoinColumn;
15
use Doctrine\ORM\Mapping\ManyToOne;
16
use Doctrine\ORM\Mapping\OneToMany;
17
use Doctrine\ORM\Mapping\Table;
18
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...
19
use Stu\Component\Spacecraft\SpacecraftRumpEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Component\Spacecraft\SpacecraftRumpEnum 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...
20
use Stu\Orm\Repository\SpacecraftRumpRepository;
21
22
#[Table(name: 'stu_rump')]
23
#[Index(name: 'rump_category_idx', columns: ['category_id'])]
24
#[Index(name: 'rump_role_idx', columns: ['role_id'])]
25
#[Entity(repositoryClass: SpacecraftRumpRepository::class)]
26
class SpacecraftRump implements SpacecraftRumpInterface
27
{
28
    #[Id]
29
    #[Column(type: 'integer')]
30
    #[GeneratedValue(strategy: 'IDENTITY')]
31
    private int $id;
32
33
    #[column(type: 'integer')]
34
    private int $category_id;
35
36
    #[column(type: 'integer', nullable: true)]
37
    private ?int $role_id = 0;
38
39
    #[column(type: 'smallint')]
40
    private int $evade_chance = 0;
41
42
    #[column(type: 'smallint')]
43
    private int $hit_chance = 0;
44
45
    #[column(type: 'smallint')]
46
    private int $module_level = 0;
47
48
    #[column(type: 'smallint')]
49
    private int $base_crew = 0;
50
51
    #[column(type: 'smallint')]
52
    private int $base_eps = 0;
53
54
    #[column(type: 'smallint')]
55
    private int $base_reactor = 0;
56
57
    #[column(type: 'integer')]
58
    private int $base_hull = 0;
59
60
    #[column(type: 'integer')]
61
    private int $base_shield = 0;
62
63
    #[column(type: 'smallint')]
64
    private int $base_damage = 0;
65
66
    #[column(type: 'smallint')]
67
    private int $base_sensor_range = 0;
68
69
    #[column(type: 'smallint')]
70
    private int $base_torpedo_storage = 0;
71
72
    #[column(type: 'smallint')]
73
    private int $phaser_volleys = 0;
74
75
    #[column(type: 'smallint')]
76
    private int $phaser_hull_damage_factor = 0;
77
78
    #[column(type: 'smallint')]
79
    private int $phaser_shield_damage_factor = 0;
80
81
    #[column(type: 'smallint')]
82
    private int $torpedo_level = 0;
83
84
    #[column(type: 'smallint')]
85
    private int $torpedo_volleys = 0;
86
87
    #[Column(type: 'string')]
88
    private string $name = '';
89
90
    #[Column(type: 'boolean')]
91
    private bool $is_buildable;
92
93
    #[Column(type: 'boolean')]
94
    private bool $is_npc;
95
96
    #[column(type: 'smallint')]
97
    private int $eps_cost = 0;
98
99
    #[column(type: 'integer')]
100
    private int $storage = 0;
101
102
    #[column(type: 'smallint')]
103
    private int $slots = 0;
104
105
    #[column(type: 'integer')]
106
    private int $buildtime = 0;
107
108
    #[column(type: 'smallint', nullable: true)]
109
    private ?int $needed_workbees = null;
110
111
    #[column(type: 'smallint')]
112
    private int $sort = 0;
113
114
    #[column(type: 'integer', nullable: true)]
115
    private ?int $database_id = 0;
116
117
    #[column(type: 'integer', nullable: true)]
118
    private ?int $commodity_id = 0;
119
120
    #[column(type: 'smallint')]
121
    private int $flight_ecost = 0;
122
123
    #[column(type: 'smallint')]
124
    private int $beam_factor = 0;
125
126
    #[column(type: 'smallint')]
127
    private int $special_slots = 0;
128
129
    #[column(type: 'smallint')]
130
    private int $shuttle_slots = 0;
131
132
    #[column(type: 'integer')]
133
    private int $tractor_mass = 1;
134
135
    #[column(type: 'integer')]
136
    private int $tractor_payload = 100;
137
138
    #[Column(type: 'integer')]
139
    private int $prestige;
140
141
    #[Column(type: 'integer')]
142
    private int $base_warpdrive = 0;
143
144
    #[Column(type: 'boolean', nullable: true)]
145
    private ?bool $npc_buildable = true;
146
147
    #[ManyToOne(targetEntity: 'ShipRumpRole')]
148
    #[JoinColumn(name: 'role_id', referencedColumnName: 'id')]
149
    private ?ShipRumpRoleInterface $shipRumpRole = null;
150
151
    /**
152
     * @var ArrayCollection<int, ShipRumpSpecialInterface>
153
     */
154
    #[OneToMany(targetEntity: 'ShipRumpSpecial', mappedBy: 'spacecraftRump', indexBy: 'special')]
155
    private Collection $specialAbilities;
156
157
    #[ManyToOne(targetEntity: 'ShipRumpCategory')]
158
    #[JoinColumn(name: 'category_id', referencedColumnName: 'id')]
159
    private ShipRumpCategoryInterface $shipRumpCategory;
160
161
    #[ManyToOne(targetEntity: 'Commodity')]
162
    #[JoinColumn(name: 'commodity_id', referencedColumnName: 'id')]
163
    private ?CommodityInterface $commodity = null;
164
165
    #[ManyToOne(targetEntity: 'DatabaseEntry')]
166
    #[JoinColumn(name: 'database_id', referencedColumnName: 'id')]
167
    private ?DatabaseEntryInterface $databaseEntry = null;
168
169
    /**
170
     * @var ArrayCollection<int, ShipRumpCostInterface>
171
     */
172
    #[OneToMany(targetEntity: 'ShipRumpCost', mappedBy: 'spacecraftRump')]
173
    private Collection $buildingCosts;
174
175
    /**
176
     * @var ArrayCollection<int, BuildplanHangarInterface>
177
     */
178
    #[OneToMany(targetEntity: 'BuildplanHangar', mappedBy: 'spacecraftRump')]
179
    private Collection $startHangar;
180
181
    public function __construct()
182
    {
183
        $this->buildingCosts = new ArrayCollection();
184
        $this->startHangar = new ArrayCollection();
185
        $this->specialAbilities = new ArrayCollection();
186
    }
187
188 37
    #[Override]
189
    public function getId(): int
190
    {
191 37
        return $this->id;
192
    }
193
194
    #[Override]
195
    public function setCategoryId(int $categoryId): SpacecraftRumpInterface
196
    {
197
        $this->category_id = $categoryId;
198
199
        return $this;
200
    }
201
202 11
    #[Override]
203
    public function getCategoryId(): int
204
    {
205 11
        return $this->category_id;
206
    }
207
208 13
    #[Override]
209
    public function getRoleId(): ?int
210
    {
211 13
        return $this->role_id;
212
    }
213
214
    #[Override]
215
    public function setRoleId(?int $roleId): SpacecraftRumpInterface
216
    {
217
        $this->role_id = $roleId;
218
        return $this;
219
    }
220
221 3
    #[Override]
222
    public function getEvadeChance(): int
223
    {
224 3
        return $this->evade_chance;
225
    }
226
227
    #[Override]
228
    public function setEvadeChance(int $evadeChance): SpacecraftRumpInterface
229
    {
230
        $this->evade_chance = $evadeChance;
231
        return $this;
232
    }
233
234 4
    #[Override]
235
    public function getHitChance(): int
236
    {
237 4
        return $this->hit_chance;
238
    }
239
240
    #[Override]
241
    public function setHitChance(int $hitChance): SpacecraftRumpInterface
242
    {
243
        $this->hit_chance = $hitChance;
244
        return $this;
245
    }
246
247 4
    #[Override]
248
    public function getModuleLevel(): int
249
    {
250 4
        return $this->module_level;
251
    }
252
253
    #[Override]
254
    public function setModuleLevel(int $moduleLevel): SpacecraftRumpInterface
255
    {
256
        $this->module_level = $moduleLevel;
257
        return $this;
258
    }
259
260 11
    #[Override]
261
    public function getBaseCrew(): int
262
    {
263 11
        return $this->base_crew;
264
    }
265
266
    #[Override]
267
    public function setBaseCrew(int $baseCrew): SpacecraftRumpInterface
268
    {
269
        $this->base_crew = $baseCrew;
270
        return $this;
271
    }
272
273 4
    #[Override]
274
    public function getBaseEps(): int
275
    {
276 4
        return $this->base_eps;
277
    }
278
279
    #[Override]
280
    public function setBaseEps(int $baseEps): SpacecraftRumpInterface
281
    {
282
        $this->base_eps = $baseEps;
283
        return $this;
284
    }
285
286 4
    #[Override]
287
    public function getBaseReactor(): int
288
    {
289 4
        return $this->base_reactor;
290
    }
291
292
    #[Override]
293
    public function setBaseReactor(int $baseReactor): SpacecraftRumpInterface
294
    {
295
        $this->base_reactor = $baseReactor;
296
        return $this;
297
    }
298
299 4
    #[Override]
300
    public function getBaseHull(): int
301
    {
302 4
        return $this->base_hull;
303
    }
304
305
    #[Override]
306
    public function setBaseHull(int $baseHull): SpacecraftRumpInterface
307
    {
308
        $this->base_hull = $baseHull;
309
        return $this;
310
    }
311
312 4
    #[Override]
313
    public function getBaseShield(): int
314
    {
315 4
        return $this->base_shield;
316
    }
317
318
    #[Override]
319
    public function setBaseShield(int $baseShield): SpacecraftRumpInterface
320
    {
321
        $this->base_shield = $baseShield;
322
        return $this;
323
    }
324
325 4
    #[Override]
326
    public function getBaseDamage(): int
327
    {
328 4
        return $this->base_damage;
329
    }
330
331
    #[Override]
332
    public function setBaseDamage(int $baseDamage): SpacecraftRumpInterface
333
    {
334
        $this->base_damage = $baseDamage;
335
        return $this;
336
    }
337
338 5
    #[Override]
339
    public function getBaseSensorRange(): int
340
    {
341 5
        return $this->base_sensor_range;
342
    }
343
344
    #[Override]
345
    public function setBaseSensorRange(int $baseSensorRange): SpacecraftRumpInterface
346
    {
347
        $this->base_sensor_range = $baseSensorRange;
348
        return $this;
349
    }
350
351 8
    #[Override]
352
    public function getBaseTorpedoStorage(): int
353
    {
354 8
        return $this->base_torpedo_storage;
355
    }
356
357
    #[Override]
358
    public function setBaseTorpedoStorage(int $baseTorpedoStorage): SpacecraftRumpInterface
359
    {
360
        $this->base_torpedo_storage = $baseTorpedoStorage;
361
        return $this;
362
    }
363
364 17
    #[Override]
365
    public function getBeamFactor(): int
366
    {
367 17
        return $this->beam_factor;
368
    }
369
370
    #[Override]
371
    public function setBeamFactor(int $beamFactor): SpacecraftRumpInterface
372
    {
373
        $this->beam_factor = $beamFactor;
374
        return $this;
375
    }
376
377 3
    #[Override]
378
    public function getSpecialSlots(): int
379
    {
380 3
        return $this->special_slots;
381
    }
382
383
    #[Override]
384
    public function setSpecialSlots(int $specialSlots): SpacecraftRumpInterface
385
    {
386
        $this->special_slots = $specialSlots;
387
        return $this;
388
    }
389
390 2
    #[Override]
391
    public function getShuttleSlots(): int
392
    {
393 2
        return $this->shuttle_slots;
394
    }
395
396
    #[Override]
397
    public function setShuttleSlots(int $shuttleSlots): SpacecraftRumpInterface
398
    {
399
        $this->shuttle_slots = $shuttleSlots;
400
        return $this;
401
    }
402
403 2
    #[Override]
404
    public function getTractorMass(): int
405
    {
406 2
        return $this->tractor_mass;
407
    }
408
409 2
    #[Override]
410
    public function getTractorPayload(): int
411
    {
412 2
        return $this->tractor_payload;
413
    }
414
415 3
    #[Override]
416
    public function getBaseWarpDrive(): int
417
    {
418 3
        return $this->base_warpdrive;
419
    }
420
421
    #[Override]
422
    public function setBaseWarpDrive(int $baseWarpDrive): SpacecraftRumpInterface
423
    {
424
        $this->base_warpdrive = $baseWarpDrive;
425
        return $this;
426
    }
427
428 6
    #[Override]
429
    public function getPhaserVolleys(): int
430
    {
431 6
        return $this->phaser_volleys;
432
    }
433
434
    #[Override]
435
    public function setPhaserVolleys(int $phaserVolleys): SpacecraftRumpInterface
436
    {
437
        $this->phaser_volleys = $phaserVolleys;
438
        return $this;
439
    }
440
441
    #[Override]
442
    public function getPhaserHullDamageFactor(): int
443
    {
444
        return $this->phaser_hull_damage_factor;
445
    }
446
447
    #[Override]
448
    public function setPhaserHullDamageFactor(int $phaserHullDamageFactor): SpacecraftRumpInterface
449
    {
450
        $this->phaser_hull_damage_factor = $phaserHullDamageFactor;
451
        return $this;
452
    }
453
454
    #[Override]
455
    public function getPhaserShieldDamageFactor(): int
456
    {
457
        return $this->phaser_shield_damage_factor;
458
    }
459
460
    #[Override]
461
    public function setPhaserShieldDamageFactor(int $phaserShieldDamageFactor): SpacecraftRumpInterface
462
    {
463
        $this->phaser_shield_damage_factor = $phaserShieldDamageFactor;
464
        return $this;
465
    }
466
467 6
    #[Override]
468
    public function getTorpedoLevel(): int
469
    {
470 6
        return $this->torpedo_level;
471
    }
472
473
    #[Override]
474
    public function setTorpedoLevel(int $torpedoLevel): SpacecraftRumpInterface
475
    {
476
        $this->torpedo_level = $torpedoLevel;
477
        return $this;
478
    }
479
480 6
    #[Override]
481
    public function getTorpedoVolleys(): int
482
    {
483 6
        return $this->torpedo_volleys;
484
    }
485
486
    #[Override]
487
    public function setTorpedoVolleys(int $torpedoVolleys): SpacecraftRumpInterface
488
    {
489
        $this->torpedo_volleys = $torpedoVolleys;
490
        return $this;
491
    }
492
493 24
    #[Override]
494
    public function getName(): string
495
    {
496 24
        return $this->name;
497
    }
498
499
    #[Override]
500
    public function setName(string $name): SpacecraftRumpInterface
501
    {
502
        $this->name = $name;
503
        return $this;
504
    }
505
506
    #[Override]
507
    public function getIsBuildable(): bool
508
    {
509
        return $this->is_buildable;
510
    }
511
512
    #[Override]
513
    public function setIsBuildable(bool $isBuildable): SpacecraftRumpInterface
514
    {
515
        $this->is_buildable = $isBuildable;
516
        return $this;
517
    }
518
519 1
    #[Override]
520
    public function getIsNpc(): bool
521
    {
522 1
        return $this->is_npc;
523
    }
524
525
    #[Override]
526
    public function setIsNpc(bool $isNpc): SpacecraftRumpInterface
527
    {
528
        $this->is_npc = $isNpc;
529
        return $this;
530
    }
531
532 4
    #[Override]
533
    public function getEpsCost(): int
534
    {
535 4
        return $this->eps_cost;
536
    }
537
538
    #[Override]
539
    public function setEpsCost(int $energyCosts): SpacecraftRumpInterface
540
    {
541
        $this->eps_cost = $energyCosts;
542
        return $this;
543
    }
544
545 19
    #[Override]
546
    public function getStorage(): int
547
    {
548 19
        return $this->storage;
549
    }
550
551
    #[Override]
552
    public function setStorage(int $storage): SpacecraftRumpInterface
553
    {
554
        $this->storage = $storage;
555
        return $this;
556
    }
557
558 2
    #[Override]
559
    public function getDockingSlots(): int
560
    {
561 2
        return $this->slots;
562
    }
563
564
    #[Override]
565
    public function setDockingSlots(int $slots): SpacecraftRumpInterface
566
    {
567
        $this->slots = $slots;
568
        return $this;
569
    }
570
571 4
    #[Override]
572
    public function getBuildtime(): int
573
    {
574 4
        return $this->buildtime;
575
    }
576
577
    #[Override]
578
    public function setBuildtime(int $buildtime): SpacecraftRumpInterface
579
    {
580
        $this->buildtime = $buildtime;
581
        return $this;
582
    }
583
584
    #[Override]
585
    public function getSort(): int
586
    {
587
        return $this->sort;
588
    }
589
590
    #[Override]
591
    public function setSort(int $sort): SpacecraftRumpInterface
592
    {
593
        $this->sort = $sort;
594
        return $this;
595
    }
596
597
    #[Override]
598
    public function getDatabaseId(): ?int
599
    {
600
        return $this->database_id;
601
    }
602
603
    #[Override]
604
    public function getCommodityId(): ?int
605
    {
606
        return $this->commodity_id;
607
    }
608
609
    #[Override]
610
    public function setCommodityId(?int $commodityId): SpacecraftRumpInterface
611
    {
612
        $this->commodity_id = $commodityId;
613
        return $this;
614
    }
615
616 8
    #[Override]
617
    public function getFlightEcost(): int
618
    {
619 8
        return $this->flight_ecost;
620
    }
621
622
    #[Override]
623
    public function setFlightEcost(int $flightEcost): SpacecraftRumpInterface
624
    {
625
        $this->flight_ecost = $flightEcost;
626
        return $this;
627
    }
628
629 5
    #[Override]
630
    public function getShipRumpRole(): ?ShipRumpRoleInterface
631
    {
632 5
        return $this->shipRumpRole;
633
    }
634
635
    #[Override]
636
    public function setShipRumpRole(?ShipRumpRoleInterface $shipRumpRole): SpacecraftRumpInterface
637
    {
638
        $this->shipRumpRole = $shipRumpRole;
639
        return $this;
640
    }
641
642 4
    #[Override]
643
    public function getShipRumpCategory(): ShipRumpCategoryInterface
644
    {
645 4
        return $this->shipRumpCategory;
646
    }
647
648
    #[Override]
649
    public function setShipRumpCategory(ShipRumpCategoryInterface $shipRumpCategory): SpacecraftRumpInterface
650
    {
651
        $this->shipRumpCategory = $shipRumpCategory;
652
        return $this;
653
    }
654
655
    #[Override]
656
    public function getCommodity(): ?CommodityInterface
657
    {
658
        return $this->commodity;
659
    }
660
661
    #[Override]
662
    public function setCommodity(?CommodityInterface $commodity): SpacecraftRumpInterface
663
    {
664
        $this->commodity = $commodity;
665
        return $this;
666
    }
667
668
    #[Override]
669
    public function getNeededWorkbees(): ?int
670
    {
671
        return $this->needed_workbees;
672
    }
673
674
    #[Override]
675
    public function getNeededRepairWorkbees(): ?int
676
    {
677
        return  $this->getNeededWorkbees() / 5;
678
    }
679
680
    #[Override]
681
    public function getDatabaseEntry(): ?DatabaseEntryInterface
682
    {
683
        return $this->databaseEntry;
684
    }
685
686
    #[Override]
687
    public function setDatabaseEntry(?DatabaseEntryInterface $databaseEntry): SpacecraftRumpInterface
688
    {
689
        $this->databaseEntry = $databaseEntry;
690
        return $this;
691
    }
692
693
    #[Override]
694
    public function getPrestige(): int
695
    {
696
        return $this->prestige;
697
    }
698
699
    #[Override]
700
    public function isEscapePods(): bool
701
    {
702
        return $this->getCategoryId() === SpacecraftRumpEnum::SHIP_CATEGORY_ESCAPE_PODS;
703
    }
704
705 2
    #[Override]
706
    public function isShipyard(): bool
707
    {
708 2
        return $this->getCategoryId() === SpacecraftRumpEnum::SHIP_CATEGORY_STATION
709 2
            && $this->getRoleId() === SpacecraftRumpEnum::SHIP_ROLE_SHIPYARD;
710
    }
711
712
    #[Override]
713
    public function isWorkbee(): bool
714
    {
715
        $commodity = $this->getCommodity();
716
717
        return $commodity !== null && $commodity->isWorkbee();
718
    }
719
720
    #[Override]
721
    public function getStartHangar(): Collection
722
    {
723
        return $this->startHangar;
724
    }
725
726 4
    #[Override]
727
    public function getBuildingCosts(): Collection
728
    {
729 4
        return $this->buildingCosts;
730
    }
731
732
    #[Override]
733
    public function hasSpecialAbility(int $value): bool
734
    {
735
        return $this->specialAbilities->containsKey($value);
736
    }
737
738 1
    #[Override]
739
    public function getFractionId(): int
740
    {
741
        //last digit of id shows fraction id
742 1
        return $this->getId() % 10;
743
    }
744
745
    /**
746
     * @return Collection<int, ShipRumpSpecialInterface>
747
     */
748
    #[Override]
749
    public function getSpecialAbilities(): Collection
750
    {
751
        return $this->specialAbilities;
752
    }
753
754
    #[Override]
755
    public function getNpcBuildable(): ?bool
756
    {
757
        return $this->npc_buildable;
758
    }
759
760
    #[Override]
761
    public function setNpcBuildable(?bool $npcBuildable): SpacecraftRumpInterface
762
    {
763
        $this->npc_buildable = $npcBuildable;
764
        return $this;
765
    }
766
}
767