diff --git a/app/Components/ApiResults/ApiResultsComponent.php b/app/Components/ApiResults/ApiResultsComponent.php index 0e478afe..f3e433c6 100644 --- a/app/Components/ApiResults/ApiResultsComponent.php +++ b/app/Components/ApiResults/ApiResultsComponent.php @@ -17,14 +17,12 @@ class ApiResultsComponent extends DIComponent { - private Connector $gameServerApiConnector; - private FKSDBDownloader $downloader; - private int $eventId; + private readonly Connector $gameServerApiConnector; + private readonly FKSDBDownloader $downloader; - public function __construct(Container $container, int $eventId) + public function __construct(Container $container, private readonly int $eventId) { parent::__construct($container); - $this->eventId = $eventId; } public function inject(Connector $connector, FKSDBDownloader $downloader): void diff --git a/app/Components/Countdown/CountdownComponent.php b/app/Components/Countdown/CountdownComponent.php index c6e6c36b..3363b909 100644 --- a/app/Components/Countdown/CountdownComponent.php +++ b/app/Components/Countdown/CountdownComponent.php @@ -9,13 +9,14 @@ class CountdownComponent extends DIComponent { - private \DateTimeInterface $countdownTo; - private string $id; + private readonly string $id; - public function __construct(Container $container, \DateTimeInterface $countdownTo, string $id = null) - { + public function __construct( + Container $container, + private readonly \DateTimeInterface $countdownTo, + string $id = null + ) { parent::__construct($container); - $this->countdownTo = $countdownTo; $this->id = $id ?? uniqid(); } diff --git a/app/Components/ImageGallery/ImageGalleryControl.php b/app/Components/ImageGallery/ImageGalleryControl.php index 3cb5e691..31e46225 100644 --- a/app/Components/ImageGallery/ImageGalleryControl.php +++ b/app/Components/ImageGallery/ImageGalleryControl.php @@ -14,8 +14,8 @@ class ImageGalleryControl extends DIComponent { - private string $wwwDir; - private Cache $cache; + private readonly string $wwwDir; + private readonly Cache $cache; public function __construct(Container $container) { diff --git a/app/Components/Map/MapComponent.php b/app/Components/Map/MapComponent.php index 56d16f7f..0d2c5d96 100644 --- a/app/Components/Map/MapComponent.php +++ b/app/Components/Map/MapComponent.php @@ -15,7 +15,7 @@ class MapComponent extends DIComponent { private static int $uniqueId = 0; - private DummyService $dummyService; + private readonly DummyService $dummyService; protected int $teamCount; /** @var string[] */ diff --git a/app/Components/PdfGallery/PdfGalleryControl.php b/app/Components/PdfGallery/PdfGalleryControl.php index fc8428e5..868f0c42 100644 --- a/app/Components/PdfGallery/PdfGalleryControl.php +++ b/app/Components/PdfGallery/PdfGalleryControl.php @@ -13,8 +13,8 @@ class PdfGalleryControl extends DIComponent { - private string $wwwDir; - private Cache $cache; + private readonly string $wwwDir; + private readonly Cache $cache; public function __construct(Container $container) { diff --git a/app/Components/PersonSchedule/AllScheduleListComponent.php b/app/Components/PersonSchedule/AllScheduleListComponent.php index 3b4ab027..aa95d81f 100644 --- a/app/Components/PersonSchedule/AllScheduleListComponent.php +++ b/app/Components/PersonSchedule/AllScheduleListComponent.php @@ -13,16 +13,14 @@ final class AllScheduleListComponent extends DIComponent { - private ServiceEventDetail $serviceEventDetail; - private int $eventId; - private FKSDBDownloader $downloader; + private readonly ServiceEventDetail $serviceEventDetail; + private readonly FKSDBDownloader $downloader; /** @var ModelPersonSchedule[][] | null */ private ?array $groupedPersonSchedule = null; - public function __construct(int $eventId, Container $container) + public function __construct(private readonly int $eventId, Container $container) { - $this->eventId = $eventId; parent::__construct($container); } diff --git a/app/Components/TeamList/TeamListComponent.php b/app/Components/TeamList/TeamListComponent.php index 3d7e4801..d4a7a90a 100644 --- a/app/Components/TeamList/TeamListComponent.php +++ b/app/Components/TeamList/TeamListComponent.php @@ -13,16 +13,14 @@ class TeamListComponent extends DIComponent { - protected DummyService $serviceTeam; - protected int $eventId; + protected readonly DummyService $serviceTeam; protected string $category; protected array $teams; - public function __construct(Container $container, int $eventId) + public function __construct(Container $container, protected readonly int $eventId) { parent::__construct($container); - $this->eventId = $eventId; } public function injectServiceTeam(DummyService $serviceTeam): void diff --git a/app/Components/TeamResults/TeamResultsComponent.php b/app/Components/TeamResults/TeamResultsComponent.php index 38715f37..a031e256 100644 --- a/app/Components/TeamResults/TeamResultsComponent.php +++ b/app/Components/TeamResults/TeamResultsComponent.php @@ -14,14 +14,12 @@ class TeamResultsComponent extends DIComponent { - protected DummyService $serviceTeam; - protected int $eventId; + protected readonly DummyService $serviceTeam; protected ?array $filterData = null; - public function __construct(Container $container, int $eventId) + public function __construct(Container $container,protected readonly int $eventId) { parent::__construct($container); - $this->eventId = $eventId; } public function injectServiceTeam(DummyService $serviceTeam): void diff --git a/app/Components/UpperHomeMap/UpperHomeMapComponent.php b/app/Components/UpperHomeMap/UpperHomeMapComponent.php index ccf78586..a8f25d64 100644 --- a/app/Components/UpperHomeMap/UpperHomeMapComponent.php +++ b/app/Components/UpperHomeMap/UpperHomeMapComponent.php @@ -13,7 +13,7 @@ final class UpperHomeMapComponent extends DIComponent { - private GamePhaseCalculator $gamePhaseCalculator; + private readonly GamePhaseCalculator $gamePhaseCalculator; public function __construct(Container $container, private readonly ModelEvent $event) { diff --git a/app/Components/UpperHomePrague/UpperHomePrague.php b/app/Components/UpperHomePrague/UpperHomePrague.php index 1af8ab96..298d029a 100644 --- a/app/Components/UpperHomePrague/UpperHomePrague.php +++ b/app/Components/UpperHomePrague/UpperHomePrague.php @@ -13,9 +13,9 @@ final class UpperHomePrague extends DIComponent { - private GamePhaseCalculator $gamePhaseCalculator; + private readonly GamePhaseCalculator $gamePhaseCalculator; - public function __construct(Container $container,private readonly ModelEvent $event) + public function __construct(Container $container, private readonly ModelEvent $event) { parent::__construct($container); } diff --git a/app/Models/GamePhaseCalculator.php b/app/Models/GamePhaseCalculator.php index 42700950..7302396c 100644 --- a/app/Models/GamePhaseCalculator.php +++ b/app/Models/GamePhaseCalculator.php @@ -10,20 +10,15 @@ use Nette\SmartObject; use Throwable; -class GamePhaseCalculator +final class GamePhaseCalculator { use SmartObject; - private ServiceEventList $serviceEventList; - private Container $container; - - private int $eventTypeId; - - public function __construct(int $eventTypeId, ServiceEventList $serviceEventList, Container $container) - { - $this->eventTypeId = $eventTypeId; - $this->serviceEventList = $serviceEventList; - $this->container = $container; + public function __construct( + private readonly int $eventTypeId, + private readonly ServiceEventList $serviceEventList, + private readonly Container $container + ) { } /** @@ -38,15 +33,6 @@ public function getGameBegin(): \DateTime return $time; } - /** - * Returns true about a week after the event when no one is interested in game already. - * @throws Throwable - */ - public function isLongAfterTheEvent(): bool - { - return $this->getFKSDBEvent()->isLongAfterTheEvent(); - } - /** * Returns newest FKSDB event. That means by creating a new one, the application automatically switches to the new * year. diff --git a/app/Models/NetteDownloader/ORM/Models/ModelEvent.php b/app/Models/NetteDownloader/ORM/Models/ModelEvent.php index 7beb12f7..1be7d399 100644 --- a/app/Models/NetteDownloader/ORM/Models/ModelEvent.php +++ b/app/Models/NetteDownloader/ORM/Models/ModelEvent.php @@ -42,7 +42,7 @@ public function getNearEventPeriod(): Period } /** * Returns true about a week after the event when no one is interested in game already. - * @throws Throwable + * @throws \Throwable */ public function isLongAfterTheEvent(): bool { diff --git a/app/Models/NetteDownloader/ORM/Services/AbstractJSONService.php b/app/Models/NetteDownloader/ORM/Services/AbstractJSONService.php index 1e315877..da5ab7ac 100644 --- a/app/Models/NetteDownloader/ORM/Services/AbstractJSONService.php +++ b/app/Models/NetteDownloader/ORM/Services/AbstractJSONService.php @@ -15,8 +15,8 @@ abstract class AbstractJSONService use SmartObject; protected NetteDownloader $downloader; - protected Cache $cache; - protected string $expiration; + protected readonly Cache $cache; + protected readonly string $expiration; public function __construct(string $expiration, Storage $storage) {