Passed
Pull Request — master (#2161)
by Janko
25:16 queued 15:11
created

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