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