diff --git a/packages/ep_products/Classes/Command/DateCommandController.php b/packages/ep_products/Classes/Command/DateCommandController.php index 8c24bb5..1ca1505 100644 --- a/packages/ep_products/Classes/Command/DateCommandController.php +++ b/packages/ep_products/Classes/Command/DateCommandController.php @@ -14,28 +14,15 @@ class DateCommandController extends Command { /** - * @var DateImportService - */ - protected $dateImportService; - - /** - * @var ProductImportSource - */ - protected $importSource; - - /** - * @param DateImportService $importService + * @param DateImportService $dateImportService * @param ProductImportSource $importSource */ public function __construct ( - DateImportService $importService, - ProductImportSource $importSource + private readonly DateImportService $dateImportService, + private readonly ProductImportSource $importSource ) { - $this->dateImportService = $importService; - $this->importSource = $importSource; - parent::__construct(); } diff --git a/packages/ep_products/Classes/Controller/AjaxCalendarController.php b/packages/ep_products/Classes/Controller/AjaxCalendarController.php index 5a670af..b1cb1bf 100644 --- a/packages/ep_products/Classes/Controller/AjaxCalendarController.php +++ b/packages/ep_products/Classes/Controller/AjaxCalendarController.php @@ -13,7 +13,7 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class AjaxCalendarController extends ActionController { - public function __construct(protected MyEpClient $myEpClient) + public function __construct(private readonly MyEpClient $myEpClient) { } diff --git a/packages/ep_products/Classes/Controller/AjaxFilterPanelController.php b/packages/ep_products/Classes/Controller/AjaxFilterPanelController.php index fa9a7fa..707e07a 100644 --- a/packages/ep_products/Classes/Controller/AjaxFilterPanelController.php +++ b/packages/ep_products/Classes/Controller/AjaxFilterPanelController.php @@ -14,17 +14,11 @@ class AjaxFilterPanelController extends ActionController use RequestArgumentTypeConversionTrait; - /** - * @var FilterService - */ - protected $filterService; - /** * @param FilterService $filterService */ - public function __construct(FilterService $filterService, private SearchResultService $searchResultService) + public function __construct(private FilterService $filterService, private SearchResultService $searchResultService) { - $this->filterService = $filterService; } public function initializeAction(): void diff --git a/packages/ep_products/Classes/Controller/AjaxSearchController.php b/packages/ep_products/Classes/Controller/AjaxSearchController.php index a99da6c..db6e2a4 100644 --- a/packages/ep_products/Classes/Controller/AjaxSearchController.php +++ b/packages/ep_products/Classes/Controller/AjaxSearchController.php @@ -15,24 +15,12 @@ class AjaxSearchController extends ActionController use RequestArgumentTypeConversionTrait; - /** - * @var FilterService - */ - protected $filterService; - - /** - * @var SearchResultService - */ - protected $searchResultService; - /** * @param FilterService $filterService * @param SearchResultService $searchResultService */ - public function __construct(FilterService $filterService, SearchResultService $searchResultService) + public function __construct(private FilterService $filterService, private SearchResultService $searchResultService) { - $this->filterService = $filterService; - $this->searchResultService = $searchResultService; } public function initializeSearchresultAction() diff --git a/packages/ep_products/Classes/Controller/AjaxTableController.php b/packages/ep_products/Classes/Controller/AjaxTableController.php index 6d05a3f..610dfc2 100644 --- a/packages/ep_products/Classes/Controller/AjaxTableController.php +++ b/packages/ep_products/Classes/Controller/AjaxTableController.php @@ -24,36 +24,6 @@ class AjaxTableController extends ActionController use RequestArgumentTypeConversionTrait; - /** - * @var ProductRepository - */ - protected $productRepository; - - /** - * @var InfoboxRepository - */ - protected $infoboxRepository; - - /** - * @var FilterService - */ - protected $filterService; - - /** - * @var DateService - */ - protected $dateService; - - /** - * @var ResellerDataService - */ - protected $resellerDataService; - - /** - * @var MyEpUrlResolverService - */ - protected $myEpUrlResolverService; - /** * @param ProductRepository $productRepository * @param InfoboxRepository $infoboxRepository @@ -63,19 +33,13 @@ class AjaxTableController extends ActionController * @param MyEpUrlResolverService $myEpUrlResolverService */ public function __construct( - ProductRepository $productRepository, - InfoboxRepository $infoboxRepository, - DateService $dateService, - FilterService $filterService, - ResellerDataService $resellerDataService, - MyEpUrlResolverService $myEpUrlResolverService + private ProductRepository $productRepository, + private InfoboxRepository $infoboxRepository, + private DateService $dateService, + private FilterService $filterService, + private ResellerDataService $resellerDataService, + private MyEpUrlResolverService $myEpUrlResolverService, ) { - $this->productRepository = $productRepository; - $this->infoboxRepository = $infoboxRepository; - $this->dateService = $dateService; - $this->filterService = $filterService; - $this->resellerDataService = $resellerDataService; - $this->myEpUrlResolverService = $myEpUrlResolverService; } public function initializeDatesAction() @@ -309,7 +273,7 @@ class AjaxTableController extends ActionController * @param Product $product * @return Infobox */ - protected function getNonBookableInfobox(Product $product) + private function getNonBookableInfobox(Product $product) { if (null !== $nonBookableInfo = $product->getNonBookableInfo()) { return $nonBookableInfo; diff --git a/packages/ep_products/Classes/Controller/AjaxWatchlistController.php b/packages/ep_products/Classes/Controller/AjaxWatchlistController.php index 3610caf..e3ab6cd 100644 --- a/packages/ep_products/Classes/Controller/AjaxWatchlistController.php +++ b/packages/ep_products/Classes/Controller/AjaxWatchlistController.php @@ -12,36 +12,16 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class AjaxWatchlistController extends ActionController { - /** - * @var ProductRepository - */ - protected $productRepository; - - /** - * @var SearchResultService - */ - protected $searchResultService; - - /** - * @var FilterService - */ - protected $filterService; - /** * @param ProductRepository $productRepository * @param SearchResultService $searchResultService * @param FilterService $filterService */ - public function __construct - ( - ProductRepository $productRepository, - SearchResultService $searchResultService, - FilterService $filterService - ) - { - $this->productRepository = $productRepository; - $this->searchResultService = $searchResultService; - $this->filterService = $filterService; + public function __construct( + private readonly ProductRepository $productRepository, + private readonly SearchResultService $searchResultService, + private readonly FilterService $filterService, + ) { } public function initializeAction(): void diff --git a/packages/ep_products/Classes/Controller/CityController.php b/packages/ep_products/Classes/Controller/CityController.php index 34cb9e3..f58f6ca 100644 --- a/packages/ep_products/Classes/Controller/CityController.php +++ b/packages/ep_products/Classes/Controller/CityController.php @@ -11,18 +11,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class CityController extends ActionController { - /** - * @var CityRepository - */ - protected $cityRepository; - /** * @param CityRepository $cityRepository * @param ProductDataService $productDataService */ - public function __construct(CityRepository $cityRepository, private readonly ProductDataService $productDataService) - { - $this->cityRepository = $cityRepository; + public function __construct( + private readonly CityRepository $cityRepository, + private readonly ProductDataService $productDataService, + ) { } /** diff --git a/packages/ep_products/Classes/Controller/ConceptController.php b/packages/ep_products/Classes/Controller/ConceptController.php index 928894a..4361bca 100644 --- a/packages/ep_products/Classes/Controller/ConceptController.php +++ b/packages/ep_products/Classes/Controller/ConceptController.php @@ -13,28 +13,16 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class ConceptController extends ActionController { - /** - * @var ConceptRepository - */ - protected $conceptRepository; - - /** - * @var ProductDataService - */ - protected $productDataService; - /** * @param ConceptRepository $conceptRepository * @param ProductDataService $productDataService * @param PageRepository $pageRepository */ public function __construct( - ConceptRepository $conceptRepository, - ProductDataService $productDataService, + private readonly ConceptRepository $conceptRepository, + private readonly ProductDataService $productDataService, private readonly PageRepository $pageRepository, ) { - $this->conceptRepository = $conceptRepository; - $this->productDataService = $productDataService; } /** diff --git a/packages/ep_products/Classes/Controller/CountryController.php b/packages/ep_products/Classes/Controller/CountryController.php index 01d6444..4834d2b 100644 --- a/packages/ep_products/Classes/Controller/CountryController.php +++ b/packages/ep_products/Classes/Controller/CountryController.php @@ -12,24 +12,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class CountryController extends ActionController { - /** - * @var CountryRepository - */ - protected $countryRepository; - - /** - * @var ProductDataService - */ - protected $productDataService; - /** * @param CountryRepository $countryRepository * @param ProductDataService $productDataService */ - public function __construct(CountryRepository $countryRepository, ProductDataService $productDataService) - { - $this->countryRepository = $countryRepository; - $this->productDataService = $productDataService; + public function __construct( + private readonly CountryRepository $countryRepository, + private readonly ProductDataService $productDataService, + ) { } /** diff --git a/packages/ep_products/Classes/Controller/FaqController.php b/packages/ep_products/Classes/Controller/FaqController.php index 22154ab..58a608f 100644 --- a/packages/ep_products/Classes/Controller/FaqController.php +++ b/packages/ep_products/Classes/Controller/FaqController.php @@ -9,17 +9,11 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class FaqController extends ActionController { - /** - * @var FaqRepository - */ - protected $faqRepository; - /** * @param FaqRepository $faqRepository */ - public function __construct(FaqRepository $faqRepository) + public function __construct(private readonly FaqRepository $faqRepository) { - $this->faqRepository = $faqRepository; } public function detailAction(): ResponseInterface diff --git a/packages/ep_products/Classes/Controller/HotelController.php b/packages/ep_products/Classes/Controller/HotelController.php index 9b2d5e4..f874898 100644 --- a/packages/ep_products/Classes/Controller/HotelController.php +++ b/packages/ep_products/Classes/Controller/HotelController.php @@ -15,44 +15,18 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class HotelController extends ActionController { - /** - * @var HotelRepository - */ - protected $hotelRepository; - - /** - * @var ProductRepository - */ - protected $productRepository; - - /** - * @var HotelDataService - */ - protected $hotelDataService; - - /** - * @var ProductDataService - */ - protected $productDataService; - /** * @param HotelDataService $hotelDataService * @param HotelRepository $hotelRepository * @param ProductRepository $productRepository * @param ProductDataService $productDataService */ - public function __construct - ( - HotelDataService $hotelDataService, - HotelRepository $hotelRepository, - ProductRepository $productRepository, - ProductDataService $productDataService - ) - { - $this->hotelRepository = $hotelRepository; - $this->productRepository = $productRepository; - $this->hotelDataService = $hotelDataService; - $this->productDataService = $productDataService; + public function __construct( + private readonly HotelDataService $hotelDataService, + private readonly HotelRepository $hotelRepository, + private readonly ProductRepository $productRepository, + private readonly ProductDataService $productDataService, + ) { } /** diff --git a/packages/ep_products/Classes/Controller/MapController.php b/packages/ep_products/Classes/Controller/MapController.php index 7b7db3f..1ad7b07 100644 --- a/packages/ep_products/Classes/Controller/MapController.php +++ b/packages/ep_products/Classes/Controller/MapController.php @@ -14,27 +14,14 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; class MapController extends ActionController { - /** - * @var HotelRepository - */ - protected $hotelRepository; - - /** - * @var ProductRepository - */ - protected $productRepository; - /** * @param HotelRepository $hotelRepository * @param ProductRepository $productRepository */ public function __construct( - HotelRepository $hotelRepository, - ProductRepository $productRepository - ) - { - $this->hotelRepository = $hotelRepository; - $this->productRepository = $productRepository; + private readonly HotelRepository $hotelRepository, + private readonly ProductRepository $productRepository, + ) { } public function generalAction(): ResponseInterface @@ -89,7 +76,7 @@ class MapController extends ActionController * @param int $pageUid * @return string */ - protected function getUriForPageUid($pageUid) + private function getUriForPageUid($pageUid) { /** @var ContentObjectRenderer $contentObject */ $contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class); diff --git a/packages/ep_products/Classes/Controller/ProductController.php b/packages/ep_products/Classes/Controller/ProductController.php index b6bf26a..3f94223 100644 --- a/packages/ep_products/Classes/Controller/ProductController.php +++ b/packages/ep_products/Classes/Controller/ProductController.php @@ -20,36 +20,6 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class ProductController extends ActionController { - /** - * @var ProductRepository - */ - protected $productRepository; - - /** - * @var HotelRepository - */ - protected $hotelRepository; - - /** - * @var FilterService - */ - protected $filterService; - - /** - * @var ProductDataService - */ - protected $productDataService; - - /** - * @var DateService - */ - protected $dateService; - - /** - * @var HotelDataService - */ - protected $hotelDataService; - /** * @param ProductRepository $productRepository * @param ProductDataService $productDataService @@ -61,21 +31,15 @@ class ProductController extends ActionController * @param PickupOverviewService $pickupOverviewService */ public function __construct( - ProductRepository $productRepository, - ProductDataService $productDataService, - HotelRepository $hotelRepository, - HotelDataService $hotelDataService, - DateService $dateService, - FilterService $filterService, + private readonly ProductRepository $productRepository, + private readonly ProductDataService $productDataService, + private readonly HotelRepository $hotelRepository, + private readonly HotelDataService $hotelDataService, + private readonly DateService $dateService, + private readonly FilterService $filterService, private readonly InfoboxRepository $infoboxRepository, - private readonly PickupOverviewService $pickupOverviewService + private readonly PickupOverviewService $pickupOverviewService, ) { - $this->productRepository = $productRepository; - $this->productDataService = $productDataService; - $this->hotelRepository = $hotelRepository; - $this->hotelDataService = $hotelDataService; - $this->dateService = $dateService; - $this->filterService = $filterService; } /** diff --git a/packages/ep_products/Classes/Controller/RegionController.php b/packages/ep_products/Classes/Controller/RegionController.php index 01066be..718d30d 100644 --- a/packages/ep_products/Classes/Controller/RegionController.php +++ b/packages/ep_products/Classes/Controller/RegionController.php @@ -12,24 +12,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class RegionController extends ActionController { - /** - * @var RegionRepository - */ - protected $regionRepository; - - /** - * @var ProductDataService - */ - protected $productDataService; - /** * @param RegionRepository $regionRepository * @param ProductDataService $productDataService */ - public function __construct(RegionRepository $regionRepository, ProductDataService $productDataService) - { - $this->regionRepository = $regionRepository; - $this->productDataService = $productDataService; + public function __construct( + private readonly RegionRepository $regionRepository, + private readonly ProductDataService $productDataService, + ) { } /** diff --git a/packages/ep_products/Classes/Controller/SearchController.php b/packages/ep_products/Classes/Controller/SearchController.php index 5e8922a..48257f0 100644 --- a/packages/ep_products/Classes/Controller/SearchController.php +++ b/packages/ep_products/Classes/Controller/SearchController.php @@ -22,17 +22,11 @@ class SearchController extends ActionController */ public const SEARCHBAR_PARAMETERS = ['dateFrom', 'dateTo', 'pax', 'destinationType', 'destinationUid', 'priceRange']; - /** - * @var FilterService - */ - protected $filterService; - /** * @param FilterService $filterService */ - public function __construct(FilterService $filterService, private SearchResultService $searchResultService) + public function __construct(private FilterService $filterService, private SearchResultService $searchResultService) { - $this->filterService = $filterService; } public function initializeSearchresultAction() diff --git a/packages/ep_products/Classes/Controller/TeamController.php b/packages/ep_products/Classes/Controller/TeamController.php index 98fe0cc..95921fc 100644 --- a/packages/ep_products/Classes/Controller/TeamController.php +++ b/packages/ep_products/Classes/Controller/TeamController.php @@ -10,17 +10,11 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class TeamController extends ActionController { - /** - * @var TeammemberRepository - */ - protected $teammemberRepository; - /** * @param TeammemberRepository $teammemberRepository */ - public function __construct(TeammemberRepository $teammemberRepository) + public function __construct(private readonly TeammemberRepository $teammemberRepository) { - $this->teammemberRepository = $teammemberRepository; } public function listAction(): ResponseInterface diff --git a/packages/ep_products/Classes/Controller/TravelinfoController.php b/packages/ep_products/Classes/Controller/TravelinfoController.php index 9e04008..8782f05 100644 --- a/packages/ep_products/Classes/Controller/TravelinfoController.php +++ b/packages/ep_products/Classes/Controller/TravelinfoController.php @@ -70,7 +70,7 @@ class TravelinfoController extends ActionController // fetch travel data via API call try { $travelData = $this->apiClient->getTravel($travelCode); - } catch (ApiException $e) { + } catch (ApiException) { $travelData = []; } diff --git a/packages/ep_products/Classes/Domain/Model/Dto/FilterOptions.php b/packages/ep_products/Classes/Domain/Model/Dto/FilterOptions.php index 40f5959..2442f14 100644 --- a/packages/ep_products/Classes/Domain/Model/Dto/FilterOptions.php +++ b/packages/ep_products/Classes/Domain/Model/Dto/FilterOptions.php @@ -19,67 +19,67 @@ class FilterOptions implements \JsonSerializable /** * @var array */ - protected $priceRanges = []; + private $priceRanges = []; /** * @var array */ - protected $destinations = []; + private $destinations = []; /** * @var array */ - protected $concepts = []; + private $concepts = []; /** * @var array */ - protected $pax = []; + private $pax = []; /** * @var array */ - protected $nights = []; + private $nights = []; /** * @var array */ - protected $hotelTypes = []; + private $hotelTypes = []; /** * @var array */ - protected $boardTypes = []; + private $boardTypes = []; /** * @var array */ - protected $roomTypes = []; + private $roomTypes = []; /** * @var \DateTime */ - protected $dateFrom; + private $dateFrom; /** * @var \DateTime */ - protected $dateTo; + private $dateTo; /** * @var bool */ - protected $busAvailable; + private $busAvailable; /** * @var int */ - protected $resultCount; + private $resultCount; /** * @var string */ - protected $resultsUri; + private $resultsUri; public function __construct() { diff --git a/packages/ep_products/Classes/Domain/Model/SearchResult.php b/packages/ep_products/Classes/Domain/Model/SearchResult.php index 89c0dd1..70e3b96 100644 --- a/packages/ep_products/Classes/Domain/Model/SearchResult.php +++ b/packages/ep_products/Classes/Domain/Model/SearchResult.php @@ -5,18 +5,12 @@ namespace EP\EpProducts\Domain\Model; class SearchResult { - /** - * @var array - */ - protected $data = []; - /** * @param array $data * @param int $total */ - public function __construct(array $data = [], protected $total = 0) + public function __construct(private array $data = [], private $total = 0) { - $this->data = $data; } /** diff --git a/packages/ep_products/Classes/Domain/Repository/HotelRepository.php b/packages/ep_products/Classes/Domain/Repository/HotelRepository.php index f3f04f4..1d1a35c 100644 --- a/packages/ep_products/Classes/Domain/Repository/HotelRepository.php +++ b/packages/ep_products/Classes/Domain/Repository/HotelRepository.php @@ -201,7 +201,7 @@ class HotelRepository extends AbstractRepository * @return QueryBuilder * @throws \Doctrine\DBAL\DBALException */ - protected function getQueryBuilder($excludeNonSearchable = true) + private function getQueryBuilder($excludeNonSearchable = true) { $qb = $this->getDbConnection()->createQueryBuilder(); diff --git a/packages/ep_products/Classes/Domain/Serialization/Services.php b/packages/ep_products/Classes/Domain/Serialization/Services.php index eeca507..3f2b1c8 100644 --- a/packages/ep_products/Classes/Domain/Serialization/Services.php +++ b/packages/ep_products/Classes/Domain/Serialization/Services.php @@ -6,7 +6,7 @@ class Services /** * @var array */ - protected static $categoryLabels = [ + private static $categoryLabels = [ 'BUS' => 'Anreise', 'VPF' => 'Verpflegung', 'SPA' => 'Skipass', diff --git a/packages/ep_products/Classes/Service/DateImportService.php b/packages/ep_products/Classes/Service/DateImportService.php index b87e92b..d625e4a 100644 --- a/packages/ep_products/Classes/Service/DateImportService.php +++ b/packages/ep_products/Classes/Service/DateImportService.php @@ -63,37 +63,22 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface /** * @var int */ - protected $pid = 0; + private $pid = 0; /** * @var array */ - protected $hotelMappings = []; + private $hotelMappings = []; /** * @var Connection */ - protected $db; - - /** - * @var CacheService - */ - protected $cacheService; - - /** - * @var ProductImportSource - */ - protected $importSource; - - /** - * @var RoomTypeResolver - */ - protected $roomTypeResolver; + private $db; /** * @var array */ - static protected $cache = [ + static private $cache = [ 'datesAdded' => [], ]; @@ -105,14 +90,10 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface */ public function __construct( ExtensionConfiguration $extensionConfiguration, - CacheService $cacheService, - ProductImportSource $importSource, - RoomTypeResolver $roomTypeResolver + private CacheService $cacheService, + private ProductImportSource $importSource, + private RoomTypeResolver $roomTypeResolver ) { - $this->cacheService = $cacheService; - $this->importSource = $importSource; - $this->roomTypeResolver = $roomTypeResolver; - // Extension configuration rather than TypoScript: the import runs on the CLI, where // TYPO3 13 has no frontend TypoScript (plugin.tx_epproducts.persistence.storagePid) $this->pid = (int)$extensionConfiguration->get('ep_products', 'importStoragePid'); @@ -152,7 +133,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param iterable $rows * @return int */ - protected function importProducts(iterable $rows): int + private function importProducts(iterable $rows): int { $products = []; foreach ($rows as $row) { @@ -206,7 +187,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array[][] $dates rows grouped by travel date * @return int */ - protected function importProduct(string $code, int $busProId, array $dates): int + private function importProduct(string $code, int $busProId, array $dates): int { $dateCount = 0; @@ -258,7 +239,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $product * @return int */ - protected function importDate(array $rows, array $product): int + private function importDate(array $rows, array $product): int { $dateCount = 0; @@ -306,7 +287,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $row * @return array */ - protected function createDateRecord(array $product, array $row): array + private function createDateRecord(array $product, array $row): array { $dateStart = \DateTime::createFromFormat('Y-m-d', $row['date']['from']); $dateEnd = \DateTime::createFromFormat('Y-m-d', $row['date']['to']); @@ -477,7 +458,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $date * @return bool */ - protected function parseHotel(array $row, array &$date): bool + private function parseHotel(array $row, array &$date): bool { $code = $row['hotel']['code']; $busProId = (int) $row['hotel']['busProId']; @@ -526,7 +507,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $date * @param array $services */ - protected function parseRooms(array $row, $hotelUid, array &$date, array $services): void + private function parseRooms(array $row, $hotelUid, array &$date, array $services): void { $minPriceOverall = 0.0; $minPriceAvailable = 0.0; @@ -630,7 +611,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $services * @return float */ - protected function determineDiscount(array $services): float + private function determineDiscount(array $services): float { foreach ($services as $key => $section) { foreach ($section as $service) { @@ -649,7 +630,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param bool $skipWithoutPrice * @return array */ - protected function parseService(array $services, bool $skipWithoutPrice = false): array + private function parseService(array $services, bool $skipWithoutPrice = false): array { $data = []; foreach ($services as $service) { @@ -709,7 +690,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param int $busProId * @return array */ - protected function parseSelectionGroup(array $selectionGroups, int $busProId): array + private function parseSelectionGroup(array $selectionGroups, int $busProId): array { $data = []; foreach ($selectionGroups as $group) { @@ -727,7 +708,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array[] $selectionGroups * @return array */ - protected function parsePersonnelSelectionGroup(array $selectionGroups): array + private function parsePersonnelSelectionGroup(array $selectionGroups): array { $data = []; foreach ($selectionGroups as $group) { @@ -753,7 +734,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $row * @return bool */ - protected function isGroupTravel(array $row): bool + private function isGroupTravel(array $row): bool { $customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER); $isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]); @@ -771,7 +752,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * * @param array $row */ - protected function checkCustomerSelection(array $row): void + private function checkCustomerSelection(array $row): void { $customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER); $isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]); @@ -793,7 +774,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array[] $selections * @param array $data */ - protected function addSelections(array $selections, array &$data): void + private function addSelections(array $selections, array &$data): void { foreach ($selections as $selection) { $data[(int) $selection['busProId']] = $selection['label']; @@ -804,7 +785,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $services * @param array $date */ - protected function processBusConditions(array $services, array &$date): void + private function processBusConditions(array $services, array &$date): void { if (!array_key_exists('BUS', $services)) { return; @@ -827,7 +808,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param string $datetime * @return string[] date as d.m.Y and time as H:i */ - protected function parsePickupDateTime(string $datetime): array + private function parsePickupDateTime(string $datetime): array { if (preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/', $datetime, $parts)) { return [$parts[3] . '.' . $parts[2] . '.' . $parts[1], $parts[4] . ':' . $parts[5]]; @@ -844,12 +825,12 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param string $price * @return float */ - protected function parseFormattedPrice(string $price): float + private function parseFormattedPrice(string $price): float { return (float) str_replace(['.', ','], ['', '.'], $price); } - protected function getHotelMappings(): void + private function getHotelMappings(): void { $sql = ' SELECT u.code code, u.uid uid, h.name name, h.type type, @@ -893,7 +874,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param int $uid * @return string */ - protected function getTopFactForRecord($table, $uid): string + private function getTopFactForRecord($table, $uid): string { $sql = ' SELECT f.name @@ -911,7 +892,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface * @param array $services * @param array $list */ - protected function addServices(array $services, array &$list): void + private function addServices(array $services, array &$list): void { foreach ($services as $key => $section) { if (!array_key_exists($key, $list)) { diff --git a/packages/ep_products/Classes/Service/DateService.php b/packages/ep_products/Classes/Service/DateService.php index 597a913..9f3eb39 100644 --- a/packages/ep_products/Classes/Service/DateService.php +++ b/packages/ep_products/Classes/Service/DateService.php @@ -14,30 +14,10 @@ use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder; class DateService implements SingletonInterface { - /** - * @var ProductRepository - */ - protected $productRepository; - - /** - * @var FilterService - */ - protected $filterService; - - /** - * @var DateRepository - */ - protected $dateRepository; - - /** - * @var UriBuilder - */ - protected $uriBuilder; - /** * @var string[] */ - protected $serviceSections = [ + private $serviceSections = [ 'BUS' => 'Anreise', 'VPF' => 'Verpflegung', 'SPA' => 'Skipass', @@ -64,18 +44,12 @@ class DateService implements SingletonInterface * @param FilterService $filterService * @param UriBuilder $uriBuilder */ - public function __construct - ( - ProductRepository $productRepository, - DateRepository $dateRepository, - FilterService $filterService, - UriBuilder $uriBuilder - ) - { - $this->productRepository = $productRepository; - $this->filterService = $filterService; - $this->dateRepository = $dateRepository; - $this->uriBuilder = $uriBuilder; + public function __construct( + private readonly ProductRepository $productRepository, + private readonly DateRepository $dateRepository, + private readonly FilterService $filterService, + private readonly UriBuilder $uriBuilder, + ) { } /** @@ -110,7 +84,7 @@ class DateService implements SingletonInterface ]); } - protected function configurePriceTableOptions(OptionsResolver $resolver) + private function configurePriceTableOptions(OptionsResolver $resolver) { $resolver->setRequired(['product', 'hotel', 'myEpUrl']); $resolver->setDefined(['filterSettings', 'date', 'paCode']); @@ -143,7 +117,7 @@ class DateService implements SingletonInterface /** * @param OptionsResolver $resolver */ - protected function configureDatesTableOptions(OptionsResolver $resolver) + private function configureDatesTableOptions(OptionsResolver $resolver) { $resolver->setDefined(['filterSettings']); $resolver->setRequired(['product', 'hotel']); diff --git a/packages/ep_products/Classes/Service/FilterService.php b/packages/ep_products/Classes/Service/FilterService.php index 9c0ec93..4d4be49 100644 --- a/packages/ep_products/Classes/Service/FilterService.php +++ b/packages/ep_products/Classes/Service/FilterService.php @@ -321,7 +321,7 @@ class FilterService implements SingletonInterface return $this->getNormalizedFilterSettings($filterSettings); } - protected function getTypoScriptSettings(): ?array + private function getTypoScriptSettings(): ?array { /** @var ConfigurationManager $configurationManager */ $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); diff --git a/packages/ep_products/Classes/Service/FilterSettingsEncoder.php b/packages/ep_products/Classes/Service/FilterSettingsEncoder.php index cea3513..a7025ee 100644 --- a/packages/ep_products/Classes/Service/FilterSettingsEncoder.php +++ b/packages/ep_products/Classes/Service/FilterSettingsEncoder.php @@ -9,7 +9,7 @@ class FilterSettingsEncoder /** * @return array */ - protected function getMapping() + private function getMapping() { return [ [ 'countryUids', 'array' ], diff --git a/packages/ep_products/Classes/Service/HotelDataService.php b/packages/ep_products/Classes/Service/HotelDataService.php index 978f169..14fe1ee 100644 --- a/packages/ep_products/Classes/Service/HotelDataService.php +++ b/packages/ep_products/Classes/Service/HotelDataService.php @@ -10,24 +10,14 @@ use TYPO3\CMS\Core\SingletonInterface; class HotelDataService implements SingletonInterface { - /** - * @var HotelRepository - */ - protected $hotelRepository; - - /** - * @var HotelImageService - */ - protected $hotelImageService; - /** * @param HotelRepository $hotelRepository * @param HotelImageService $hotelImageService */ - public function __construct(HotelRepository $hotelRepository, HotelImageService $hotelImageService) - { - $this->hotelRepository = $hotelRepository; - $this->hotelImageService = $hotelImageService; + public function __construct( + private readonly HotelRepository $hotelRepository, + private readonly HotelImageService $hotelImageService, + ) { } /** @@ -107,7 +97,7 @@ class HotelDataService implements SingletonInterface * @param array $teaserData * @return array */ - protected function preprocessTeaserData(array $teaserData) + private function preprocessTeaserData(array $teaserData) { $teasers = []; foreach ($teaserData as $row) diff --git a/packages/ep_products/Classes/Service/ProductDataService.php b/packages/ep_products/Classes/Service/ProductDataService.php index f972f73..89d7c0b 100644 --- a/packages/ep_products/Classes/Service/ProductDataService.php +++ b/packages/ep_products/Classes/Service/ProductDataService.php @@ -8,26 +8,6 @@ use TYPO3\CMS\Core\SingletonInterface; class ProductDataService implements SingletonInterface { - /** - * @var ProductRepository - */ - protected $productRepository; - - /** - * @var HotelRepository - */ - protected $hotelRepository; - - /** - * @var ProductImageService - */ - protected $productImageService; - - /** - * @var HotelImageService - */ - protected $hotelImageService; - /** * @param ProductRepository $productRepository * @param HotelRepository $hotelRepository @@ -35,15 +15,11 @@ class ProductDataService implements SingletonInterface * @param ProductImageService $productImageService */ public function __construct( - ProductRepository $productRepository, - HotelRepository $hotelRepository, - HotelImageService $hotelImageService, - ProductImageService $productImageService + private readonly ProductRepository $productRepository, + private readonly HotelRepository $hotelRepository, + private readonly HotelImageService $hotelImageService, + private readonly ProductImageService $productImageService, ) { - $this->productRepository = $productRepository; - $this->hotelRepository = $hotelRepository; - $this->productImageService = $productImageService; - $this->hotelImageService = $hotelImageService; } /** diff --git a/packages/ep_products/Classes/Service/ResellerDataService.php b/packages/ep_products/Classes/Service/ResellerDataService.php index 3b6d359..a1d6d37 100644 --- a/packages/ep_products/Classes/Service/ResellerDataService.php +++ b/packages/ep_products/Classes/Service/ResellerDataService.php @@ -19,17 +19,11 @@ class ResellerDataService implements SingletonInterface { use DbConnectionTrait; - /** - * @var ProductRepository - */ - protected $productRepository; - /** * @param ProductRepository $productRepository */ - public function __construct(ProductRepository $productRepository) + public function __construct(private ProductRepository $productRepository) { - $this->productRepository = $productRepository; } /** @@ -40,8 +34,12 @@ class ResellerDataService implements SingletonInterface * @return array * @throws \Doctrine\DBAL\DBALException */ - public function preprocessAll(Reseller $reseller, string $myEpUrl, ?array $imageProcessingInstructions = null, $type = 'facebook') - { + public function preprocessAll( + Reseller $reseller, + string $myEpUrl, + ?array $imageProcessingInstructions = null, + $type = 'facebook', + ) { $data = []; $products = $reseller->getProducts(); diff --git a/packages/ep_products/Classes/Service/RoomTypeResolver.php b/packages/ep_products/Classes/Service/RoomTypeResolver.php index eeeb41f..0f578fc 100644 --- a/packages/ep_products/Classes/Service/RoomTypeResolver.php +++ b/packages/ep_products/Classes/Service/RoomTypeResolver.php @@ -91,7 +91,7 @@ class RoomTypeResolver * @param array $patterns * @return bool */ - protected function matchesAny(string $label, array $patterns): bool + private function matchesAny(string $label, array $patterns): bool { return array_any($patterns, fn($pattern) => str_contains(mb_strtolower($label), mb_strtolower($pattern))); } diff --git a/packages/ep_products/Classes/Service/SearchResultService.php b/packages/ep_products/Classes/Service/SearchResultService.php index 8a829b7..742cd7b 100644 --- a/packages/ep_products/Classes/Service/SearchResultService.php +++ b/packages/ep_products/Classes/Service/SearchResultService.php @@ -15,35 +15,16 @@ class SearchResultService implements SingletonInterface public const DESTINATION_TYPE_CITY = 'city'; public const DESTINATION_TYPE_CONCEPT = 'concept'; - /** - * @var ProductRepository - */ - protected $productRepository; - - /** - * @var HotelImageService - */ - protected $hotelImageService; - - /** - * @var ProductImageService - */ - protected $productImageService; - /** * @param ProductRepository $productRepository * @param HotelImageService $hotelImageService * @param ProductImageService $productImageService */ public function __construct( - ProductRepository $productRepository, - HotelImageService $hotelImageService, - ProductImageService $productImageService - ) - { - $this->productRepository = $productRepository; - $this->hotelImageService = $hotelImageService; - $this->productImageService = $productImageService; + private readonly ProductRepository $productRepository, + private readonly HotelImageService $hotelImageService, + private readonly ProductImageService $productImageService, + ) { } public function getNormalizedSearchParams(array $searchParams = []): array diff --git a/packages/ep_products/Classes/Utility/SerializationUtility.php b/packages/ep_products/Classes/Utility/SerializationUtility.php index 12ce410..e8f95e6 100644 --- a/packages/ep_products/Classes/Utility/SerializationUtility.php +++ b/packages/ep_products/Classes/Utility/SerializationUtility.php @@ -14,12 +14,12 @@ class SerializationUtility /** * @var ImageService */ - protected static $imageService; + private static $imageService; /** * @var ContentObjectRenderer */ - protected static $contentObject; + private static $contentObject; /** * @param $text @@ -69,7 +69,7 @@ class SerializationUtility /** * @return ImageService */ - protected static function getImageService() + private static function getImageService() { if (static::$imageService === null) { static::$imageService = GeneralUtility::makeInstance(ImageService::class); diff --git a/packages/ep_products/Classes/Utility/SettingsUtility.php b/packages/ep_products/Classes/Utility/SettingsUtility.php index cba6511..cb63eae 100644 --- a/packages/ep_products/Classes/Utility/SettingsUtility.php +++ b/packages/ep_products/Classes/Utility/SettingsUtility.php @@ -11,7 +11,7 @@ class SettingsUtility /** * @var array */ - protected $settings = []; + private $settings = []; public function __construct() { diff --git a/packages/ep_products/Classes/Utility/TypeConversionUtility.php b/packages/ep_products/Classes/Utility/TypeConversionUtility.php index 941db53..a76df04 100644 --- a/packages/ep_products/Classes/Utility/TypeConversionUtility.php +++ b/packages/ep_products/Classes/Utility/TypeConversionUtility.php @@ -20,7 +20,7 @@ class TypeConversionUtility return (int) $value; } if (\is_array($value)) { - return array_map(fn($item) => static::convertType($item), $value); + return array_map(static::convertType(...), $value); } if (empty($value)) { return null; diff --git a/packages/ep_theme/Classes/DataProcessing/SliderProcessor.php b/packages/ep_theme/Classes/DataProcessing/SliderProcessor.php index ee4cdc8..fdbeb31 100644 --- a/packages/ep_theme/Classes/DataProcessing/SliderProcessor.php +++ b/packages/ep_theme/Classes/DataProcessing/SliderProcessor.php @@ -74,7 +74,7 @@ class SliderProcessor implements DataProcessorInterface /** * @return null|int */ - protected function getParentPageWithSlides() + private function getParentPageWithSlides() { $rootlineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId()); $rootline = $rootlineUtility->get(); diff --git a/packages/ep_theme/Classes/MetaTag/OpenGraphMetaTagManager.php b/packages/ep_theme/Classes/MetaTag/OpenGraphMetaTagManager.php index 5def35f..b2848fa 100644 --- a/packages/ep_theme/Classes/MetaTag/OpenGraphMetaTagManager.php +++ b/packages/ep_theme/Classes/MetaTag/OpenGraphMetaTagManager.php @@ -53,7 +53,7 @@ class OpenGraphMetaTagManager extends \TYPO3\CMS\Seo\MetaTag\OpenGraphMetaTagMan /** * @return null|int */ - protected function getPageWithImage() + private function getPageWithImage() { // The manager is also asked to render in the backend, where there is no frontend page $pageInformation = $GLOBALS['TYPO3_REQUEST']?->getAttribute('frontend.page.information'); diff --git a/packages/ep_theme/Classes/Preview/ContentPreviewRenderer.php b/packages/ep_theme/Classes/Preview/ContentPreviewRenderer.php index 90d55c1..578b8b9 100644 --- a/packages/ep_theme/Classes/Preview/ContentPreviewRenderer.php +++ b/packages/ep_theme/Classes/Preview/ContentPreviewRenderer.php @@ -25,7 +25,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer /** * CType => [field holding the related uid, related table, template variable] */ - protected const RELATED_RECORDS = [ + private const array RELATED_RECORDS = [ 'teaser_country' => ['tx_eptheme_context_country', 'tx_epproducts_domain_model_country', 'country'], 'teaser_region' => ['tx_eptheme_context_region', 'tx_epproducts_domain_model_region', 'region'], 'teaser_city' => ['tx_eptheme_context_city', 'tx_epproducts_domain_model_city', 'city'], @@ -63,7 +63,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer return $view->render(); } - protected function getAssignmentsForTemplate(string $cType, array $row): array + private function getAssignmentsForTemplate(string $cType, array $row): array { if (isset(self::RELATED_RECORDS[$cType])) { [$field, $table, $name] = self::RELATED_RECORDS[$cType]; @@ -110,7 +110,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer return []; } - protected function getImages(int $uid, string $table, string $field): array + private function getImages(int $uid, string $table, string $field): array { if ($uid <= 0) { return []; diff --git a/packages/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php b/packages/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php index 1f18922..c1520ff 100644 --- a/packages/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php +++ b/packages/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php @@ -10,7 +10,7 @@ class ContainerViewHelper extends AbstractViewHelper /** * @var int[] */ - protected static $scale = [ + private static $scale = [ 'default' => 0, 'small' => 8, 'large' => 16, @@ -25,7 +25,7 @@ class ContainerViewHelper extends AbstractViewHelper /** * @var array */ - protected static $columnsWithoutContainers = [ 0, 1, 3 ]; + private static $columnsWithoutContainers = [ 0, 1, 3 ]; public function initializeArguments() { diff --git a/packages/ep_theme/Classes/ViewHelpers/IconViewHelper.php b/packages/ep_theme/Classes/ViewHelpers/IconViewHelper.php index 060052c..68329e8 100644 --- a/packages/ep_theme/Classes/ViewHelpers/IconViewHelper.php +++ b/packages/ep_theme/Classes/ViewHelpers/IconViewHelper.php @@ -33,7 +33,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper return $this->tag->render(); } - protected static function getImageService() + private static function getImageService() { return GeneralUtility::makeInstance(ImageService::class); }