Passed
Push — dev ( 4d4f83...13e3b4 )
by Janko
20:05
created

User::setMobile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
cp 0
crap 2
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\Game\GameEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Component\Game\GameEnum 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...
22
use Stu\Component\Game\ModuleEnum;
23
use Stu\Component\Map\MapEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Component\Map\MapEnum 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\Component\Player\UserAwardEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Component\Player\UserAwardEnum 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...
25
use Stu\Component\Player\UserCssClassEnum;
26
use Stu\Component\Player\UserRpgBehaviorEnum;
27
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...
28
use Stu\Module\PlayerSetting\Lib\UserSettingEnum;
29
use Stu\Orm\Repository\UserRepository;
30
31
#[Table(name: 'stu_user')]
32
#[Index(name: 'user_alliance_idx', columns: ['allys_id'])]
33
#[Entity(repositoryClass: UserRepository::class)]
34
class User implements UserInterface
35
{
36
    #[Id]
37
    #[Column(type: 'integer')]
38
    #[GeneratedValue(strategy: 'IDENTITY')]
39
    private int $id;
40
41
    #[Column(type: 'string')]
42
    private string $username = '';
43
44
    #[Column(type: 'integer', nullable: true)]
45
    private ?int $allys_id = null;
46
47
    #[Column(type: 'integer')]
48
    private int $race = 9;
49
50
    #[Column(type: 'smallint')]
51
    private int $state = UserEnum::USER_STATE_NEW;
52
53
    #[Column(type: 'integer')]
54
    private int $lastaction = 0;
55
56
    #[Column(type: 'integer')]
57
    private int $kn_lez = 0;
58
59
    #[Column(type: 'boolean')]
60
    private bool $vac_active = false;
61
62
    #[Column(type: 'integer')]
63
    private int $vac_request_date = 0;
64
65
    #[Column(type: 'text')]
66
    private string $description = '';
67
68
    #[Column(type: 'smallint', nullable: true)]
69
    private ?int $maptype = MapEnum::MAPTYPE_INSERT;
0 ignored issues
show
introduced by
The private property $maptype is not used, and could be removed.
Loading history...
70
71
    #[Column(type: 'text')]
72
    private string $sessiondata = '';
73
74
    #[Column(type: 'integer')]
75
    private int $prestige = 0;
76
77
    #[Column(type: 'boolean')]
78
    private bool $deals = false;
79
80
    #[Column(type: 'integer', nullable: true)]
81
    private ?int $last_boarding = null;
82
83
    #[OneToOne(targetEntity: 'UserRegistration', mappedBy: 'user', cascade: ['all'])]
84
    private UserRegistrationInterface $registration;
85
86
    #[ManyToOne(targetEntity: 'Alliance', inversedBy: 'members')]
87
    #[JoinColumn(name: 'allys_id', referencedColumnName: 'id')]
88
    private ?AllianceInterface $alliance = null;
89
90
    #[ManyToOne(targetEntity: 'Faction')]
91
    #[JoinColumn(name: 'race', referencedColumnName: 'id')]
92
    private FactionInterface $faction;
93
94
    /**
95
     * @var ArrayCollection<int, BuoyInterface>
96
     */
97
    #[OneToMany(targetEntity: 'Buoy', mappedBy: 'user')]
98
    private Collection $buoys;
99
100
    /**
101
     * @var ArrayCollection<int, UserAwardInterface>
102
     */
103
    #[OneToMany(targetEntity: 'UserAward', mappedBy: 'user', indexBy: 'award_id')]
104
    #[OrderBy(['award_id' => 'ASC'])]
105
    private Collection $awards;
106
107
    /**
108
     * @var ArrayCollection<int, ColonyInterface>
109
     */
110
    #[OneToMany(targetEntity: 'Colony', mappedBy: 'user', indexBy: 'id')]
111
    #[OrderBy(['colonies_classes_id' => 'ASC', 'id' => 'ASC'])]
112
    private Collection $colonies;
113
114
    /**
115
     * @var ArrayCollection<int, UserLayerInterface>
116
     */
117
    #[OneToMany(targetEntity: 'UserLayer', mappedBy: 'user', indexBy: 'layer_id')]
118
    private Collection $userLayers;
119
120
    #[OneToOne(targetEntity: 'UserLock', mappedBy: 'user')]
121
    private ?UserLockInterface $userLock = null;
122
123
    /**
124
     * @var ArrayCollection<string, UserSettingInterface>
125
     */
126
    #[OneToMany(targetEntity: 'UserSetting', mappedBy: 'user', indexBy: 'setting')]
127
    private Collection $settings;
128
129
    /**
130
     * @var ArrayCollection<int, UserCharacterInterface>
131
     */
132
    #[OneToMany(targetEntity: 'UserCharacter', mappedBy: 'user')]
133
    private Collection $characters;
134
135
    /**
136
     * @var ArrayCollection<int, ColonyScanInterface>
137
     */
138
    #[OneToMany(targetEntity: 'ColonyScan', mappedBy: 'user', indexBy: 'id', fetch: 'EXTRA_LAZY')]
139
    #[OrderBy(['colony_id' => 'ASC', 'date' => 'ASC'])]
140
    private Collection $colonyScans;
141
142
    #[OneToOne(targetEntity: 'PirateWrath', mappedBy: 'user')]
143
    private ?PirateWrathInterface $pirateWrath = null;
144
145
    /**
146
     * @var ArrayCollection<int, UserTutorialInterface>
147
     */
148
    #[OneToMany(targetEntity: 'UserTutorial', mappedBy: 'user', indexBy: 'tutorial_step_id', fetch: 'EXTRA_LAZY')]
149
    private Collection $tutorials;
150
151
    /** @var null|array<mixed> */
152
    private $sessiondataUnserialized;
153
154
    /**
155
     * @var ArrayCollection<int, WormholeRestriction>
156
     */
157
    #[OneToMany(targetEntity: 'WormholeRestriction', mappedBy: 'user')]
158
    private Collection $wormholeRestrictions;
159
160
    public function __construct()
161
    {
162
        $this->awards = new ArrayCollection();
163
        $this->colonies = new ArrayCollection();
164
        $this->userLayers = new ArrayCollection();
165
        $this->settings = new ArrayCollection();
166
        $this->characters = new ArrayCollection();
167
        $this->buoys = new ArrayCollection();
168
        $this->colonyScans = new ArrayCollection();
169
        $this->tutorials = new ArrayCollection();
170
        $this->wormholeRestrictions = new ArrayCollection();
171
    }
172
173 201
    #[Override]
174
    public function getId(): int
175
    {
176 201
        return $this->id;
177
    }
178
179 3
    #[Override]
180
    public function getRegistration(): UserRegistrationInterface
181
    {
182 3
        return $this->registration;
183
    }
184
185
    #[Override]
186
    public function setRegistration(UserRegistrationInterface $registration): UserInterface
187
    {
188
        $this->registration = $registration;
189
190
        return $this;
191
    }
192
193 201
    #[Override]
194
    public function getName(): string
195
    {
196
        //if UMODE active, add info to user name
197 201
        if ($this->isVacationRequestOldEnough()) {
198
            return $this->username . '[b][color=red] (UMODE)[/color][/b]';
199
        }
200 201
        return $this->username;
201
    }
202
203
    #[Override]
204
    public function setUsername(string $username): UserInterface
205
    {
206
        $this->username = $username;
207
        return $this;
208
    }
209
210 1
    #[Override]
211
    public function getRgbCode(): string
212
    {
213 1
        $setting = $this->getSettings()->get(UserSettingEnum::RGB_CODE->value);
214 1
        if ($setting !== null) {
215
            return $setting->getValue();
216
        }
217
218 1
        return '';
219
    }
220
221 201
    #[Override]
222
    public function getCss(): string
223
    {
224 201
        $setting = $this->getSettings()->get(UserSettingEnum::CSS_COLOR_SHEET->value);
225 201
        if ($setting !== null) {
226
            return $setting->getValue();
227
        }
228
229 201
        return UserCssClassEnum::BLACK->value;
230
    }
231
232 201
    #[Override]
233
    public function getFactionId(): int
234
    {
235 201
        return $this->race;
236
    }
237
238
    #[Override]
239
    public function setFaction(FactionInterface $faction): UserInterface
240
    {
241
        $this->faction = $faction;
242
        return $this;
243
    }
244
245 11
    #[Override]
246
    public function getFaction(): FactionInterface
247
    {
248 11
        return $this->faction;
249
    }
250
251 1
    #[Override]
252
    public function getAwards(): Collection
253
    {
254 1
        return $this->awards;
255
    }
256
257 12
    #[Override]
258
    public function getColonies(): Collection
259
    {
260 12
        return $this->colonies;
261
    }
262
263 2
    #[Override]
264
    public function hasColony(): bool
265
    {
266
        if (
267 2
            $this->getState() === UserEnum::USER_STATE_COLONIZATION_SHIP
268 2
            || $this->getState() === UserEnum::USER_STATE_UNCOLONIZED
269
        ) {
270
            return false;
271
        }
272
273 2
        return !$this->getColonies()->isEmpty();
274
    }
275
276 6
    #[Override]
277
    public function getState(): int
278
    {
279 6
        return $this->state;
280
    }
281
282 1
    #[Override]
283
    public function isLocked(): bool
284
    {
285 1
        return $this->getUserLock() !== null && $this->getUserLock()->getRemainingTicks() > 0;
286
    }
287
288 1
    #[Override]
289
    public function getUserStateDescription(): string
290
    {
291 1
        if ($this->isLocked()) {
292
            return _('GESPERRT');
293
        }
294 1
        return UserEnum::getUserStateDescription($this->getState());
295
    }
296
297
    #[Override]
298
    public function setState(int $state): UserInterface
299
    {
300
        $this->state = $state;
301
        return $this;
302
    }
303
304 201
    #[Override]
305
    public function getAvatar(): string
306
    {
307 201
        $setting = $this->getSettings()->get(UserSettingEnum::AVATAR->value);
308 201
        if ($setting !== null) {
309
            return $setting->getValue();
310
        }
311
312 201
        return '';
313
    }
314
315 1
    #[Override]
316
    public function isEmailNotification(): bool
317
    {
318 1
        $setting = $this->getSettings()->get(UserSettingEnum::EMAIL_NOTIFICATION->value);
319 1
        if ($setting !== null) {
320
            return (bool)$setting->getValue();
321
        }
322
323 1
        return false;
324
    }
325
326 4
    #[Override]
327
    public function getLastaction(): int
328
    {
329 4
        return $this->lastaction;
330
    }
331
332
    #[Override]
333
    public function setLastaction(int $lastaction): UserInterface
334
    {
335
        $this->lastaction = $lastaction;
336
        return $this;
337
    }
338
339 4
    #[Override]
340
    public function getKnMark(): int
341
    {
342 4
        return $this->kn_lez;
343
    }
344
345
    #[Override]
346
    public function setKnMark(int $knMark): UserInterface
347
    {
348
        $this->kn_lez = $knMark;
349
        return $this;
350
    }
351
352 201
    #[Override]
353
    public function isVacationMode(): bool
354
    {
355 201
        return $this->vac_active;
356
    }
357
358
    #[Override]
359
    public function setVacationMode(bool $vacationMode): UserInterface
360
    {
361
        $this->vac_active = $vacationMode;
362
        return $this;
363
    }
364
365
    #[Override]
366
    public function getVacationRequestDate(): int
367
    {
368
        return $this->vac_request_date;
369
    }
370
371
    #[Override]
372
    public function setVacationRequestDate(int $date): UserInterface
373
    {
374
        $this->vac_request_date = $date;
375
376
        return $this;
377
    }
378
379 201
    #[Override]
380
    public function isVacationRequestOldEnough(): bool
381
    {
382 201
        return $this->isVacationMode() && (time() - $this->getVacationRequestDate() > UserEnum::VACATION_DELAY_IN_SECONDS);
383
    }
384
385 1
    #[Override]
386
    public function isStorageNotification(): bool
387
    {
388 1
        $setting = $this->getSettings()->get(UserSettingEnum::STORAGE_NOTIFICATION->value);
389 1
        if ($setting !== null) {
390
            return (bool)$setting->getValue();
391
        }
392
393 1
        return false;
394
    }
395
396 2
    #[Override]
397
    public function getDescription(): string
398
    {
399 2
        return $this->description;
400
    }
401
402
    #[Override]
403
    public function setDescription(string $description): UserInterface
404
    {
405
        $this->description = $description;
406
        return $this;
407
    }
408
409 5
    #[Override]
410
    public function isShowOnlineState(): bool
411
    {
412 5
        $setting = $this->getSettings()->get(UserSettingEnum::SHOW_ONLINE_STATUS->value);
413 5
        if ($setting !== null) {
414
            return (bool)$setting->getValue();
415
        }
416
417 5
        return false;
418
    }
419
420 2
    #[Override]
421
    public function isShowPmReadReceipt(): bool
422
    {
423 2
        $setting = $this->getSettings()->get(UserSettingEnum::SHOW_PM_READ_RECEIPT->value);
424 2
        if ($setting !== null) {
425 1
            return (bool)$setting->getValue();
426
        }
427
428 2
        return false;
429
    }
430
431 1
    #[Override]
432
    public function isSaveLogin(): bool
433
    {
434 1
        $setting = $this->getSettings()->get(UserSettingEnum::SAVE_LOGIN->value);
435 1
        if ($setting !== null) {
436
            return (bool)$setting->getValue();
437
        }
438
439 1
        return false;
440
    }
441
442 1
    #[Override]
443
    public function getFleetFixedDefault(): bool
444
    {
445 1
        $setting = $this->getSettings()->get(UserSettingEnum::FLEET_FIXED_DEFAULT->value);
446 1
        if ($setting !== null) {
447
            return (bool)$setting->getValue();
448
        }
449
450 1
        return false;
451
    }
452
453 1
    #[Override]
454
    public function getWarpsplitAutoCarryoverDefault(): bool
455
    {
456 1
        $setting = $this->getSettings()->get(UserSettingEnum::WARPSPLIT_AUTO_CARRYOVER_DEFAULT->value);
457 1
        if ($setting !== null) {
458
            return (bool)$setting->getValue();
459
        }
460
461 1
        return false;
462
    }
463
464 5
    #[Override]
465
    public function getUserLayers(): Collection
466
    {
467 5
        return $this->userLayers;
468
    }
469
470 4
    #[Override]
471
    public function hasSeen(int $layerId): bool
472
    {
473 4
        return $this->getUserLayers()->containsKey($layerId);
474
    }
475
476 4
    #[Override]
477
    public function hasExplored(int $layerId): bool
478
    {
479 4
        return $this->hasSeen($layerId) && $this->getUserLayers()->get($layerId)->isExplored();
480
    }
481
482 201
    #[Override]
483
    public function getSettings(): Collection
484
    {
485 201
        return $this->settings;
486
    }
487
488 1
    #[Override]
489
    public function getSessiondata(): string
490
    {
491 1
        return $this->sessiondata;
492
    }
493
494
    #[Override]
495
    public function setSessiondata(string $sessiondata): UserInterface
496
    {
497
        $this->sessiondata = $sessiondata;
498
        $this->sessiondataUnserialized = null;
499
        return $this;
500
    }
501
502 5
    #[Override]
503
    public function getPrestige(): int
504
    {
505 5
        return $this->prestige;
506
    }
507
508
    #[Override]
509
    public function setPrestige(int $prestige): UserInterface
510
    {
511
        $this->prestige = $prestige;
512
        return $this;
513
    }
514
515 2
    #[Override]
516
    public function getDefaultView(): ModuleEnum
517
    {
518 2
        $setting = $this->getSettings()->get(UserSettingEnum::DEFAULT_VIEW->value);
519 2
        if ($setting !== null) {
520
            return ModuleEnum::from($setting->getValue());
521
        }
522
523 2
        return ModuleEnum::MAINDESK;
524
    }
525
526 5
    #[Override]
527
    public function getRpgBehavior(): UserRpgBehaviorEnum
528
    {
529 5
        $setting = $this->getSettings()->get(UserSettingEnum::RPG_BEHAVIOR->value);
530 5
        if ($setting !== null) {
531
            return UserRpgBehaviorEnum::from((int)$setting->getValue());
532
        }
533
534 5
        return UserRpgBehaviorEnum::NOT_SET;
535
    }
536
537 3
    #[Override]
538
    public function getDeals(): bool
539
    {
540 3
        return $this->deals;
541
    }
542
543 1
    #[Override]
544
    public function setDeals(bool $deals): UserInterface
545
    {
546 1
        $this->deals = $deals;
547 1
        return $this;
548
    }
549
550
    #[Override]
551
    public function getLastBoarding(): ?int
552
    {
553
        return $this->last_boarding;
554
    }
555
556
    #[Override]
557
    public function setLastBoarding(int $lastBoarding): UserInterface
558
    {
559
        $this->last_boarding = $lastBoarding;
560
        return $this;
561
    }
562
563 2
    #[Override]
564
    public function isOnline(): bool
565
    {
566 2
        return !($this->getLastAction() < time() - GameEnum::USER_ONLINE_PERIOD);
567
    }
568
569 20
    #[Override]
570
    public function getAlliance(): ?AllianceInterface
571
    {
572 20
        return $this->alliance;
573
    }
574
575
    #[Override]
576
    public function setAlliance(?AllianceInterface $alliance): UserInterface
577
    {
578
        $this->alliance = $alliance;
579
        return $this;
580
    }
581
582
    #[Override]
583
    public function setAllianceId(?int $allianceId): UserInterface
584
    {
585
        $this->allys_id = $allianceId;
586
        return $this;
587
    }
588
589 3
    #[Override]
590
    public function getSessionDataUnserialized(): array
591
    {
592 3
        if ($this->sessiondataUnserialized === null) {
593 1
            $this->sessiondataUnserialized = unserialize($this->getSessionData());
594 1
            if (!is_array($this->sessiondataUnserialized)) {
595 1
                $this->sessiondataUnserialized = [];
596
            }
597
        }
598 3
        return $this->sessiondataUnserialized;
599
    }
600
601 1
    #[Override]
602
    public function isContactable(): bool
603
    {
604 1
        return $this->getId() != UserEnum::USER_NOONE;
605
    }
606
607 200
    #[Override]
608
    public function hasAward(int $awardId): bool
609
    {
610 200
        return $this->awards->containsKey($awardId) === true;
611
    }
612
613 4
    #[Override]
614
    public function hasStationsPmCategory(): bool
615
    {
616 4
        if ($this->isNpc()) {
617
            return true;
618
        }
619
620 4
        return $this->hasAward(UserAwardEnum::RESEARCHED_STATIONS);
621
    }
622
623 205
    public static function isUserNpc(int $userId): bool
624
    {
625 205
        return $userId < UserEnum::USER_FIRST_ID;
626
    }
627
628 201
    #[Override]
629
    public function isNpc(): bool
630
    {
631 201
        return self::isUserNpc($this->getId());
632
    }
633
634 1
    #[Override]
635
    public function getUserLock(): ?UserLockInterface
636
    {
637 1
        return $this->userLock;
638
    }
639
640
    #[Override]
641
    public function __toString(): string
642
    {
643
        return sprintf('userName: %s', $this->getName());
644
    }
645
646
    #[Override]
647
    public function hasTranslation(): bool
648
    {
649
        $text = $this->getDescription();
650
        return strpos($text, '[translate]') !== false && strpos($text, '[/translate]') !== false;
651
    }
652
653 4
    #[Override]
654
    public function isShowPirateHistoryEntrys(): bool
655
    {
656 4
        $setting = $this->getSettings()->get(UserSettingEnum::SHOW_PIRATE_HISTORY_ENTRYS->value);
657 4
        if ($setting !== null) {
658
            return (bool)$setting->getValue();
659
        }
660
661 4
        return false;
662
    }
663
664 3
    #[Override]
665
    public function isInboxMessengerStyle(): bool
666
    {
667 3
        $setting = $this->getSettings()->get(UserSettingEnum::INBOX_MESSENGER_STYLE->value);
668 3
        if ($setting !== null) {
669 1
            return (bool)$setting->getValue();
670
        }
671
672 2
        return false;
673
    }
674
675 1
    #[Override]
676
    public function getCharacters(): Collection
677
    {
678 1
        return $this->characters;
679
    }
680
681 1
    #[Override]
682
    public function getColonyScans(): Collection
683
    {
684 1
        return $this->colonyScans;
685
    }
686
687
    /**
688
     * @return Collection<int, BuoyInterface>
689
     */
690
    public function getBuoys(): Collection
691
    {
692
        return $this->buoys;
693
    }
694
695 2
    #[Override]
696
    public function getPirateWrath(): ?PirateWrathInterface
697
    {
698 2
        return $this->pirateWrath;
699
    }
700
701
    #[Override]
702
    public function setPirateWrath(?PirateWrathInterface $wrath): UserInterface
703
    {
704
        $this->pirateWrath = $wrath;
705
706
        return $this;
707
    }
708
709
    #[Override]
710
    public function isProtectedAgainstPirates(): bool
711
    {
712
        $pirateWrath = $this->pirateWrath;
713
        if ($pirateWrath === null) {
714
            return false;
715
        }
716
717
        $timeout = $pirateWrath->getProtectionTimeout();
718
        if ($timeout === null) {
719
            return false;
720
        }
721
722
        return $timeout > time();
723
    }
724
725
    /**
726
     * @return Collection<int, UserTutorialInterface>
727
     */
728
    #[Override]
729
    public function getTutorials(): Collection
730
    {
731
        return $this->tutorials;
732
    }
733
734
    #[Override]
735
    /**
736
     * @return Collection<int, WormholeRestriction>
737
     */
738
    public function getWormholeRestrictions(): iterable
739
    {
740
        return $this->wormholeRestrictions;
741
    }
742
}
743