Passed
Push — dev ( 20f168...3a8ec2 )
by Nico
15:39
created

Colony::getUserDepositMinings()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.3332

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 0
dl 0
loc 12
ccs 4
cts 6
cp 0.6667
crap 3.3332
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A Colony::setUser() 0 5 1
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\OneToOne;
18
use Doctrine\ORM\Mapping\OrderBy;
19
use Doctrine\ORM\Mapping\Table;
20
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...
21
use Stu\Component\Colony\ColonyMenuEnum;
22
use Stu\Component\Game\ModuleEnum;
23
use Stu\Component\Game\TimeConstants;
0 ignored issues
show
Bug introduced by
The type Stu\Component\Game\TimeConstants 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...
24
use Stu\Lib\Colony\PlanetFieldHostTypeEnum;
25
use Stu\Lib\Transfer\CommodityTransfer;
26
use Stu\Lib\Transfer\TransferEntityTypeEnum;
27
use Stu\Module\Colony\View\ShowColony\ShowColony;
28
use Stu\Module\PlayerSetting\Lib\UserEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Module\PlayerSetting\Lib\UserEnum 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...
29
use Stu\Orm\Repository\ColonyRepository;
30
31
#[Table(name: 'stu_colonies')]
32
#[Index(name: 'colony_user_idx', columns: ['user_id'])]
33
#[Index(name: 'colony_classes_idx', columns: ['colonies_classes_id'])]
34
#[Index(name: 'colony_sys_map_idx', columns: ['starsystem_map_id'])]
35
#[Entity(repositoryClass: ColonyRepository::class)]
36
class Colony implements ColonyInterface
37
{
38
    #[Id]
39
    #[Column(type: 'integer')]
40
    #[GeneratedValue(strategy: 'IDENTITY')]
41
    private int $id;
42
43
    #[Column(type: 'integer')]
44
    private int $colonies_classes_id = 0;
45
46
    #[Column(type: 'integer')]
47
    private int $user_id = 0;
48
49
    #[Column(type: 'integer')]
50
    private int $starsystem_map_id = 0;
0 ignored issues
show
introduced by
The private property $starsystem_map_id is not used, and could be removed.
Loading history...
51
52
    #[Column(type: 'string')]
53
    private string $name = '';
54
55
    #[Column(type: 'string', length: 100)]
56
    private string $planet_name = '';
57
58
    #[Column(type: 'integer', length: 5)]
59
    private int $bev_work = 0;
60
61
    #[Column(type: 'integer', length: 5)]
62
    private int $bev_free = 0;
63
64
    #[Column(type: 'integer', length: 5)]
65
    private int $bev_max = 0;
66
67
    #[Column(type: 'integer', length: 5)]
68
    private int $eps = 0;
69
70
    #[Column(type: 'integer', length: 5)]
71
    private int $max_eps = 0;
72
73
    #[Column(type: 'integer', length: 5)]
74
    private int $max_storage = 0;
75
76
    #[Column(type: 'text', nullable: true)]
77
    private ?string $mask = null;
78
79
    #[Column(type: 'integer', nullable: true)]
80
    private ?int $database_id = null;
81
82
    #[Column(type: 'integer', length: 5)]
83
    private int $populationlimit = 0;
84
85
    #[Column(type: 'boolean')]
86
    private bool $immigrationstate = true;
87
88
    #[Column(type: 'integer', length: 6, nullable: true)]
89
    private ?int $shields = 0;
90
91
    #[Column(type: 'integer', length: 6, nullable: true)]
92
    private ?int $shield_frequency = 0;
93
94
    #[Column(type: 'integer', length: 3, nullable: true)]
95
    private ?int $torpedo_type = null;
0 ignored issues
show
introduced by
The private property $torpedo_type is not used, and could be removed.
Loading history...
96
97
    #[Column(type: 'integer', length: 3)]
98
    private int $rotation_factor = 1;
99
100
    #[Column(type: 'integer', length: 2)]
101
    private int $surface_width = 0;
102
103
    #[ManyToOne(targetEntity: 'ColonyClass')]
104
    #[JoinColumn(name: 'colonies_classes_id', referencedColumnName: 'id')]
105
    private ColonyClassInterface $colonyClass;
106
107
    #[OneToOne(targetEntity: 'StarSystemMap', inversedBy: 'colony')]
108
    #[JoinColumn(name: 'starsystem_map_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
109
    private StarSystemMapInterface $starsystem_map;
110
111
    #[ManyToOne(targetEntity: 'User')]
112
    #[JoinColumn(name: 'user_id', referencedColumnName: 'id')]
113
    private UserInterface $user;
114
115
    /**
116
     * @var ArrayCollection<int, PlanetFieldInterface>
117
     */
118
    #[OneToMany(targetEntity: 'PlanetField', mappedBy: 'colony', indexBy: 'field_id', fetch: 'EXTRA_LAZY')]
119
    #[OrderBy(['field_id' => 'ASC'])]
120
    private Collection $planetFields;
121
122
    /**
123
     * @var ArrayCollection<int, StorageInterface>
124
     */
125
    #[OneToMany(targetEntity: 'Storage', mappedBy: 'colony', indexBy: 'commodity_id')]
126
    #[OrderBy(['commodity_id' => 'ASC'])]
127
    private Collection $storage;
128
129
    #[ManyToOne(targetEntity: 'TorpedoType')]
130
    #[JoinColumn(name: 'torpedo_type', referencedColumnName: 'id')]
131
    private ?TorpedoTypeInterface $torpedo = null;
132
133
    #[OneToOne(targetEntity: 'DatabaseEntry')]
134
    #[JoinColumn(name: 'database_id', referencedColumnName: 'id')]
135
    private ?DatabaseEntryInterface $databaseEntry;
136
137
    /**
138
     * @var ArrayCollection<int, FleetInterface>
139
     */
140
    #[OneToMany(targetEntity: 'Fleet', mappedBy: 'defendedColony')]
141
    private Collection $defenders;
142
143
    /**
144
     * @var ArrayCollection<int, FleetInterface>
145
     */
146
    #[OneToMany(targetEntity: 'Fleet', mappedBy: 'blockedColony')]
147
    private Collection $blockers;
148
149
    /**
150
     * @var ArrayCollection<int, CrewAssignmentInterface>
151
     */
152
    #[OneToMany(targetEntity: 'CrewAssignment', mappedBy: 'colony')]
153
    private Collection $crewAssignments;
154
155
    /**
156
     * @var ArrayCollection<int, CrewAssignmentInterface>
157
     */
158
    #[OneToMany(targetEntity: 'CrewTraining', mappedBy: 'colony')]
159
    private Collection $crewTrainings;
160
161
    /** @var array<int, int> */
162
    private array $twilightZones = [];
163
164
    public function __construct()
165
    {
166
        $this->planetFields = new ArrayCollection();
167
        $this->storage = new ArrayCollection();
168
        $this->defenders = new ArrayCollection();
169
        $this->blockers = new ArrayCollection();
170
        $this->crewAssignments = new ArrayCollection();
171
        $this->crewTrainings = new ArrayCollection();
172
    }
173
174 45
    #[Override]
175
    public function getId(): int
176
    {
177 45
        return $this->id;
178
    }
179
180 9
    #[Override]
181
    public function getColonyClassId(): int
182
    {
183 9
        return $this->colonies_classes_id;
184
    }
185
186 39
    #[Override]
187
    public function getUserId(): int
188
    {
189 39
        return $this->user_id;
190
    }
191
192 10
    #[Override]
193
    public function getSx(): int
194
    {
195 10
        return $this->getStarsystemMap()->getSx();
196
    }
197
198 10
    #[Override]
199
    public function getSy(): int
200
    {
201 10
        return $this->getStarsystemMap()->getSy();
202
    }
203
204
    #[Override]
205
    public function getSystemsId(): int
206
    {
207
        return $this->getSystem()->getId();
208
    }
209
210 19
    #[Override]
211
    public function getName(): string
212
    {
213 19
        return $this->name;
214
    }
215
216 2
    #[Override]
217
    public function getNameAndSectorString(): string
218
    {
219 2
        return sprintf(
220 2
            '%s %s',
221 2
            $this->getName(),
222 2
            $this->getSectorString()
223 2
        );
224
    }
225
226 4
    #[Override]
227
    public function getSystemString(): string
228
    {
229 4
        return sprintf('%s-System (%s|%s)', $this->getSystem()->getName(), $this->getSystem()->getCx(), $this->getSystem()->getCy());
230
    }
231
232
    #[Override]
233
    public function setName(string $name): ColonyInterface
234
    {
235
        $this->name = $name;
236
        return $this;
237
    }
238
239 4
    #[Override]
240
    public function getPlanetName(): string
241
    {
242 4
        return $this->planet_name;
243
    }
244
245
    #[Override]
246
    public function setPlanetName(string $planet_name): ColonyInterface
247
    {
248
        $this->planet_name = $planet_name;
249
        return $this;
250
    }
251
252 10
    #[Override]
253
    public function getWorkers(): int
254
    {
255 10
        return $this->bev_work;
256
    }
257
258
    #[Override]
259
    public function setWorkers(int $bev_work): ColonyInterface
260
    {
261
        $this->bev_work = $bev_work;
262
        return $this;
263
    }
264
265 10
    #[Override]
266
    public function getWorkless(): int
267
    {
268 10
        return $this->bev_free;
269
    }
270
271
    #[Override]
272
    public function setWorkless(int $bev_free): ColonyInterface
273
    {
274
        $this->bev_free = $bev_free;
275
        return $this;
276
    }
277
278 5
    #[Override]
279
    public function getMaxBev(): int
280
    {
281 5
        return $this->bev_max;
282
    }
283
284
    #[Override]
285
    public function setMaxBev(int $bev_max): ColonyInterface
286
    {
287
        $this->bev_max = $bev_max;
288
        return $this;
289
    }
290
291 11
    #[Override]
292
    public function getEps(): int
293
    {
294 11
        return $this->eps;
295
    }
296
297
    #[Override]
298
    public function setEps(int $eps): ColonyInterface
299
    {
300
        $this->eps = $eps;
301
        return $this;
302
    }
303
304 9
    #[Override]
305
    public function getMaxEps(): int
306
    {
307 9
        return $this->max_eps;
308
    }
309
310
    #[Override]
311
    public function setMaxEps(int $max_eps): ColonyInterface
312
    {
313
        $this->max_eps = $max_eps;
314
        return $this;
315
    }
316
317 13
    #[Override]
318
    public function getMaxStorage(): int
319
    {
320 13
        return $this->max_storage;
321
    }
322
323
    #[Override]
324
    public function setMaxStorage(int $max_storage): ColonyInterface
325
    {
326
        $this->max_storage = $max_storage;
327
        return $this;
328
    }
329
330
    #[Override]
331
    public function getMask(): ?string
332
    {
333
        return $this->mask;
334
    }
335
336
    #[Override]
337
    public function setMask(?string $mask): ColonyInterface
338
    {
339
        $this->mask = $mask;
340
        return $this;
341
    }
342
343
    #[Override]
344
    public function getDatabaseId(): ?int
345
    {
346
        return $this->database_id;
347
    }
348
349
    #[Override]
350
    public function setDatabaseEntry(?DatabaseEntryInterface $entry): ColonyInterface
351
    {
352
        $this->databaseEntry = $entry;
353
        return $this;
354
    }
355
356 6
    #[Override]
357
    public function getPopulationlimit(): int
358
    {
359 6
        return $this->populationlimit;
360
    }
361
362
    #[Override]
363
    public function setPopulationlimit(int $populationlimit): ColonyInterface
364
    {
365
        $this->populationlimit = $populationlimit;
366
        return $this;
367
    }
368
369 6
    #[Override]
370
    public function getImmigrationstate(): bool
371
    {
372 6
        return $this->immigrationstate;
373
    }
374
375
    #[Override]
376
    public function setImmigrationstate(bool $immigrationstate): ColonyInterface
377
    {
378
        $this->immigrationstate = $immigrationstate;
379
        return $this;
380
    }
381
382
    #[Override]
383
    public function getShields(): ?int
384
    {
385
        return $this->shields;
386
    }
387
388
    #[Override]
389
    public function setShields(?int $shields): ColonyInterface
390
    {
391
        $this->shields = $shields;
392
        return $this;
393
    }
394
395 6
    #[Override]
396
    public function getTwilightZone(int $timestamp): int
397
    {
398 6
        if (array_key_exists($timestamp, $this->twilightZones)) {
399 6
            return $this->twilightZones[$timestamp];
400
        }
401
402 1
        $twilightZone = 0;
403
404 1
        $width = $this->getSurfaceWidth();
405 1
        $rotationTime = $this->getRotationTime();
406 1
        $colonyTimeSeconds = $this->getColonyTimeSeconds($timestamp);
407
408 1
        if ($this->getDayTimePrefix($timestamp) == 1) {
409
            $scaled = floor((((100 / ($rotationTime * 0.125)) * ($colonyTimeSeconds - $rotationTime * 0.25)) / 100) * $width);
410
            if ($scaled == 0) {
411
                $twilightZone = - (($width) - 1);
412
            } elseif ((int) - (($width) - ceil($scaled)) == 0) {
413
                $twilightZone = -1;
414
            } else {
415
                $twilightZone = (int) - (($width) - $scaled);
416
            }
417
        }
418 1
        if ($this->getDayTimePrefix($timestamp) == 2) {
419 1
            $twilightZone = $width;
420
        }
421 1
        if ($this->getDayTimePrefix($timestamp) == 3) {
422
            $scaled = floor((((100 / ($rotationTime * 0.125)) * ($colonyTimeSeconds - $rotationTime * 0.75)) / 100) * $width);
423
            $twilightZone = (int) ($width - $scaled);
424
        }
425 1
        if ($this->getDayTimePrefix($timestamp) == 4) {
426
            $twilightZone = 0;
427
        }
428
429 1
        $this->twilightZones[$timestamp] = $twilightZone;
430
431 1
        return $twilightZone;
432
    }
433
434
    #[Override]
435
    public function getShieldFrequency(): ?int
436
    {
437
        return $this->shield_frequency;
438
    }
439
440
    #[Override]
441
    public function setShieldFrequency(?int $shieldFrequency): ColonyInterface
442
    {
443
        $this->shield_frequency = $shieldFrequency;
444
        return $this;
445
    }
446
447
    #[Override]
448
    public function getTorpedo(): ?TorpedoTypeInterface
449
    {
450
        return $this->torpedo;
451
    }
452
453
    #[Override]
454
    public function setTorpedo(?TorpedoTypeInterface $torpedoType): ColonyInterface
455
    {
456
        $this->torpedo = $torpedoType;
457
        return $this;
458
    }
459
460 4
    #[Override]
461
    public function getRotationFactor(): int
462
    {
463 4
        return $this->rotation_factor;
464
    }
465
466
    #[Override]
467
    public function setRotationFactor(int $rotationFactor): ColonyInterface
468
    {
469
        $this->rotation_factor = $rotationFactor;
470
471
        return $this;
472
    }
473
474 4
    #[Override]
475
    public function getRotationTime(): int
476
    {
477 4
        return (int) (TimeConstants::ONE_DAY_IN_SECONDS * $this->getRotationFactor() / 100);
478
    }
479
480 4
    public function getColonyTimeSeconds(int $timestamp): int
481
    {
482 4
        return $timestamp % $this->getRotationTime();
483
    }
484
485 4
    #[Override]
486
    public function getColonyTimeHour(int $timestamp): ?string
487
    {
488 4
        $rotationTime = $this->getRotationTime();
489
490 4
        return sprintf("%02d", (int) floor(($rotationTime / 3600) * ($this->getColonyTimeSeconds($timestamp) / $rotationTime)));
491
    }
492
493 4
    #[Override]
494
    public function getColonyTimeMinute(int $timestamp): ?string
495
    {
496 4
        $rotationTime = $this->getRotationTime();
497
498 4
        return sprintf("%02d", (int) floor(60 * (($rotationTime / 3600) * ($this->getColonyTimeSeconds($timestamp) / $rotationTime) - ((int) $this->getColonyTimeHour($timestamp)))));
499
    }
500
501 4
    #[Override]
502
    public function getDayTimePrefix(int $timestamp): ?int
503
    {
504 4
        $daytimeprefix = null;
505 4
        $daypercent = (int) (($this->getColonyTimeSeconds($timestamp) / $this->getRotationTime()) * 100);
506 4
        if ($daypercent > 25 && $daypercent <= 37.5) {
507
            $daytimeprefix = 1; //Sonnenaufgang
508
        }
509 4
        if ($daypercent > 37.5 && $daypercent <= 75) {
510 4
            $daytimeprefix = 2; //Tag
511
        }
512 4
        if ($daypercent > 75 && $daypercent <= 87.5) {
513
            $daytimeprefix = 3; //Sonnenuntergang
514
        }
515 4
        if ($daypercent > 87.5 || $daypercent <= 25) {
516
            $daytimeprefix = 4; //Nacht
517
        }
518 4
        return $daytimeprefix;
519
    }
520
521 4
    #[Override]
522
    public function getDayTimeName(int $timestamp): ?string
523
    {
524 4
        $daytimename = null;
525 4
        if ($this->getDayTimePrefix($timestamp) == 1) {
526
            $daytimename = 'Morgen';
527
        }
528
529 4
        if ($this->getDayTimePrefix($timestamp) == 2) {
530 4
            $daytimename = 'Tag';
531
        }
532
533 4
        if ($this->getDayTimePrefix($timestamp) == 3) {
534
            $daytimename = 'Abend';
535
        }
536
537 4
        if ($this->getDayTimePrefix($timestamp) == 4) {
538
            $daytimename = 'Nacht';
539
        }
540 4
        return $daytimename;
541
    }
542
543 6
    #[Override]
544
    public function getSurfaceWidth(): int
545
    {
546 6
        return $this->surface_width;
547
    }
548
549
    #[Override]
550
    public function setSurfaceWidth(int $surfaceWidth): ColonyInterface
551
    {
552
        $this->surface_width = $surfaceWidth;
553
        return $this;
554
    }
555
556 22
    #[Override]
557
    public function getColonyClass(): ColonyClassInterface
558
    {
559 22
        return $this->colonyClass;
560
    }
561
562
    #[Override]
563
    public function setColonyClass(ColonyClassInterface $colonyClass): ColonyInterface
564
    {
565
        $this->colonyClass = $colonyClass;
566
        return $this;
567
    }
568
569 13
    #[Override]
570
    public function getStorageSum(): int
571
    {
572 13
        return array_reduce(
573 13
            $this->getStorage()->getValues(),
574 13
            fn(int $sum, StorageInterface $storage): int => $sum + $storage->getAmount(),
575 13
            0
576 13
        );
577
    }
578
579
    #[Override]
580
    public function storagePlaceLeft(): bool
581
    {
582
        return $this->getMaxStorage() > $this->getStorageSum();
583
    }
584
585 19
    #[Override]
586
    public function getStarsystemMap(): StarSystemMapInterface
587
    {
588 19
        return $this->starsystem_map;
589
    }
590
591 10
    #[Override]
592
    public function getLocation(): MapInterface|StarSystemMapInterface
593
    {
594 10
        return $this->getStarsystemMap();
595
    }
596
597
    #[Override]
598
    public function setStarsystemMap(StarSystemMapInterface $systemMap): ColonyInterface
599
    {
600
        $this->starsystem_map = $systemMap;
601
602
        return $this;
603
    }
604
605 10
    #[Override]
606
    public function getSystem(): StarSystemInterface
607
    {
608 10
        return $this->getStarsystemMap()->getSystem();
609
    }
610
611 2
    #[Override]
612
    public function getBeamFactor(): int
613
    {
614 2
        return 10;
615
    }
616
617 5
    #[Override]
618
    public function getPlanetFields(): Collection
619
    {
620 5
        return $this->planetFields;
621
    }
622
623 2
    #[Override]
624
    public function getBeamableStorage(): Collection
625
    {
626 2
        return CommodityTransfer::excludeNonBeamable($this->storage);
627
    }
628
629 20
    #[Override]
630
    public function getStorage(): Collection
631
    {
632 20
        return $this->storage;
633
    }
634
635 1
    #[Override]
636
    public function isDefended(): bool
637
    {
638 1
        return !$this->getDefenders()->isEmpty();
639
    }
640
641 1
    #[Override]
642
    public function getDefenders(): Collection
643
    {
644 1
        return $this->defenders;
645
    }
646
647 1
    #[Override]
648
    public function isBlocked(): bool
649
    {
650 1
        return !$this->getBlockers()->isEmpty();
651
    }
652
653 1
    #[Override]
654
    public function getBlockers(): Collection
655
    {
656 1
        return $this->blockers;
657
    }
658
659
    #[Override]
660
    public function getCrewAssignments(): Collection
661
    {
662
        return $this->crewAssignments;
663
    }
664
665 3
    #[Override]
666
    public function getCrewAssignmentAmount(): int
667
    {
668 3
        return $this->crewAssignments->count();
669
    }
670
671 1
    #[Override]
672
    public function getCrewTrainingAmount(): int
673
    {
674 1
        return $this->crewTrainings->count();
675
    }
676
677 5
    #[Override]
678
    public function isFree(): bool
679
    {
680 5
        return $this->getUserId() === UserEnum::USER_NOONE;
681
    }
682
683 16
    #[Override]
684
    public function getUser(): UserInterface
685
    {
686 16
        return $this->user;
687
    }
688
689
    #[Override]
690
    public function setUser(UserInterface $user): ColonyInterface
691
    {
692
        $this->user = $user;
693
        return $this;
694
    }
695
696 10
    #[Override]
697
    public function getPopulation(): int
698
    {
699 10
        return $this->getWorkers() + $this->getWorkless();
700
    }
701
702 4
    #[Override]
703
    public function getFreeHousing(): int
704
    {
705 4
        return $this->getMaxBev() - $this->getPopulation();
706
    }
707
708
    #[Override]
709
    public function lowerEps(int $value): void
710
    {
711
        $this->setEps($this->getEps() - $value);
712
    }
713
714
    #[Override]
715
    public function upperEps(int $value): void
716
    {
717
        $this->setEps($this->getEps() + $value);
718
    }
719
720 2
    #[Override]
721
    public function getSectorString(): string
722
    {
723 2
        return $this->getStarsystemMap()->getSectorString();
724
    }
725
726 12
    #[Override]
727
    public function getPlanetFieldHostIdentifier(): string
728
    {
729 12
        return 'colony';
730
    }
731
732 15
    #[Override]
733
    public function getPlanetFieldHostColumnIdentifier(): string
734
    {
735 15
        return 'colonies_id';
736
    }
737
738
    #[Override]
739
    public function isColony(): bool
740
    {
741
        return true;
742
    }
743
744 20
    #[Override]
745
    public function getHostType(): PlanetFieldHostTypeEnum
746
    {
747 20
        return PlanetFieldHostTypeEnum::COLONY;
748
    }
749
750
    #[Override]
751
    public function getDefaultViewIdentifier(): string
752
    {
753
        return ShowColony::VIEW_IDENTIFIER;
754
    }
755
756
    #[Override]
757
    public function isMenuAllowed(ColonyMenuEnum $menu): bool
758
    {
759
        return true;
760
    }
761
762 4
    #[Override]
763
    public function getTransferEntityType(): TransferEntityTypeEnum
764
    {
765 4
        return TransferEntityTypeEnum::COLONY;
766
    }
767
768
    #[Override]
769
    public function getHref(): string
770
    {
771
        return sprintf(
772
            '%s?%s=1&id=%d',
773
            ModuleEnum::COLONY->getPhpPage(),
774
            ShowColony::VIEW_IDENTIFIER,
775
            $this->getId()
776
        );
777
    }
778
779
    #[Override]
780
    public function getComponentParameters(): string
781
    {
782
        return sprintf(
783
            '&hosttype=%d&id=%d',
784
            $this->getHostType()->value,
785
            $this->getId()
786
        );
787
    }
788
}
789