refactor: private instead of protected where nothing relies on it, constructor promotion

Members (properties, methods, constants) become private when they are
declared in the class itself, no parent class or interface declares them,
no ancestor in packages/ uses them and the class has no subclass in
packages/: 115 members in 36 files. Extbase domain objects keep protected
properties, AbstractDomainObject sets them from the parent class.

With the properties private, Rector's constructor promotion now also
applies to the controllers and services that still assigned their
dependencies by hand (26 files).

Checked locally: frontend crawl (~1,900 URLs) and the backchannel APIs
render the same as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-26 11:05:45 +01:00
1 parent b51fa4ddad
commit 9347112d6b
38 files changed
+140 -462

No files matched your search

@@ -14,28 +14,15 @@ class DateCommandController extends Command
{ {
/** /**
* @var DateImportService * @param DateImportService $dateImportService
*/
protected $dateImportService;
/**
* @var ProductImportSource
*/
protected $importSource;
/**
* @param DateImportService $importService
* @param ProductImportSource $importSource * @param ProductImportSource $importSource
*/ */
public function __construct public function __construct
( (
DateImportService $importService, private readonly DateImportService $dateImportService,
ProductImportSource $importSource private readonly ProductImportSource $importSource
) )
{ {
$this->dateImportService = $importService;
$this->importSource = $importSource;
parent::__construct(); parent::__construct();
} }
@@ -13,7 +13,7 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class AjaxCalendarController extends ActionController class AjaxCalendarController extends ActionController
{ {
public function __construct(protected MyEpClient $myEpClient) public function __construct(private readonly MyEpClient $myEpClient)
{ {
} }
@@ -14,17 +14,11 @@ class AjaxFilterPanelController extends ActionController
use RequestArgumentTypeConversionTrait; use RequestArgumentTypeConversionTrait;
/**
* @var FilterService
*/
protected $filterService;
/** /**
* @param FilterService $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 public function initializeAction(): void
@@ -15,24 +15,12 @@ class AjaxSearchController extends ActionController
use RequestArgumentTypeConversionTrait; use RequestArgumentTypeConversionTrait;
/**
* @var FilterService
*/
protected $filterService;
/**
* @var SearchResultService
*/
protected $searchResultService;
/** /**
* @param FilterService $filterService * @param FilterService $filterService
* @param SearchResultService $searchResultService * @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() public function initializeSearchresultAction()
@@ -24,36 +24,6 @@ class AjaxTableController extends ActionController
use RequestArgumentTypeConversionTrait; 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 ProductRepository $productRepository
* @param InfoboxRepository $infoboxRepository * @param InfoboxRepository $infoboxRepository
@@ -63,19 +33,13 @@ class AjaxTableController extends ActionController
* @param MyEpUrlResolverService $myEpUrlResolverService * @param MyEpUrlResolverService $myEpUrlResolverService
*/ */
public function __construct( public function __construct(
ProductRepository $productRepository, private ProductRepository $productRepository,
InfoboxRepository $infoboxRepository, private InfoboxRepository $infoboxRepository,
DateService $dateService, private DateService $dateService,
FilterService $filterService, private FilterService $filterService,
ResellerDataService $resellerDataService, private ResellerDataService $resellerDataService,
MyEpUrlResolverService $myEpUrlResolverService private MyEpUrlResolverService $myEpUrlResolverService,
) { ) {
$this->productRepository = $productRepository;
$this->infoboxRepository = $infoboxRepository;
$this->dateService = $dateService;
$this->filterService = $filterService;
$this->resellerDataService = $resellerDataService;
$this->myEpUrlResolverService = $myEpUrlResolverService;
} }
public function initializeDatesAction() public function initializeDatesAction()
@@ -309,7 +273,7 @@ class AjaxTableController extends ActionController
* @param Product $product * @param Product $product
* @return Infobox * @return Infobox
*/ */
protected function getNonBookableInfobox(Product $product) private function getNonBookableInfobox(Product $product)
{ {
if (null !== $nonBookableInfo = $product->getNonBookableInfo()) { if (null !== $nonBookableInfo = $product->getNonBookableInfo()) {
return $nonBookableInfo; return $nonBookableInfo;
@@ -12,36 +12,16 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class AjaxWatchlistController extends ActionController class AjaxWatchlistController extends ActionController
{ {
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var SearchResultService
*/
protected $searchResultService;
/**
* @var FilterService
*/
protected $filterService;
/** /**
* @param ProductRepository $productRepository * @param ProductRepository $productRepository
* @param SearchResultService $searchResultService * @param SearchResultService $searchResultService
* @param FilterService $filterService * @param FilterService $filterService
*/ */
public function __construct public function __construct(
( private readonly ProductRepository $productRepository,
ProductRepository $productRepository, private readonly SearchResultService $searchResultService,
SearchResultService $searchResultService, private readonly FilterService $filterService,
FilterService $filterService ) {
)
{
$this->productRepository = $productRepository;
$this->searchResultService = $searchResultService;
$this->filterService = $filterService;
} }
public function initializeAction(): void public function initializeAction(): void
@@ -11,18 +11,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class CityController extends ActionController class CityController extends ActionController
{ {
/**
* @var CityRepository
*/
protected $cityRepository;
/** /**
* @param CityRepository $cityRepository * @param CityRepository $cityRepository
* @param ProductDataService $productDataService * @param ProductDataService $productDataService
*/ */
public function __construct(CityRepository $cityRepository, private readonly ProductDataService $productDataService) public function __construct(
{ private readonly CityRepository $cityRepository,
$this->cityRepository = $cityRepository; private readonly ProductDataService $productDataService,
) {
} }
/** /**
@@ -13,28 +13,16 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class ConceptController extends ActionController class ConceptController extends ActionController
{ {
/**
* @var ConceptRepository
*/
protected $conceptRepository;
/**
* @var ProductDataService
*/
protected $productDataService;
/** /**
* @param ConceptRepository $conceptRepository * @param ConceptRepository $conceptRepository
* @param ProductDataService $productDataService * @param ProductDataService $productDataService
* @param PageRepository $pageRepository * @param PageRepository $pageRepository
*/ */
public function __construct( public function __construct(
ConceptRepository $conceptRepository, private readonly ConceptRepository $conceptRepository,
ProductDataService $productDataService, private readonly ProductDataService $productDataService,
private readonly PageRepository $pageRepository, private readonly PageRepository $pageRepository,
) { ) {
$this->conceptRepository = $conceptRepository;
$this->productDataService = $productDataService;
} }
/** /**
@@ -12,24 +12,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class CountryController extends ActionController class CountryController extends ActionController
{ {
/**
* @var CountryRepository
*/
protected $countryRepository;
/**
* @var ProductDataService
*/
protected $productDataService;
/** /**
* @param CountryRepository $countryRepository * @param CountryRepository $countryRepository
* @param ProductDataService $productDataService * @param ProductDataService $productDataService
*/ */
public function __construct(CountryRepository $countryRepository, ProductDataService $productDataService) public function __construct(
{ private readonly CountryRepository $countryRepository,
$this->countryRepository = $countryRepository; private readonly ProductDataService $productDataService,
$this->productDataService = $productDataService; ) {
} }
/** /**
@@ -9,17 +9,11 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class FaqController extends ActionController class FaqController extends ActionController
{ {
/**
* @var FaqRepository
*/
protected $faqRepository;
/** /**
* @param FaqRepository $faqRepository * @param FaqRepository $faqRepository
*/ */
public function __construct(FaqRepository $faqRepository) public function __construct(private readonly FaqRepository $faqRepository)
{ {
$this->faqRepository = $faqRepository;
} }
public function detailAction(): ResponseInterface public function detailAction(): ResponseInterface
@@ -15,44 +15,18 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class HotelController extends 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 HotelDataService $hotelDataService
* @param HotelRepository $hotelRepository * @param HotelRepository $hotelRepository
* @param ProductRepository $productRepository * @param ProductRepository $productRepository
* @param ProductDataService $productDataService * @param ProductDataService $productDataService
*/ */
public function __construct public function __construct(
( private readonly HotelDataService $hotelDataService,
HotelDataService $hotelDataService, private readonly HotelRepository $hotelRepository,
HotelRepository $hotelRepository, private readonly ProductRepository $productRepository,
ProductRepository $productRepository, private readonly ProductDataService $productDataService,
ProductDataService $productDataService ) {
)
{
$this->hotelRepository = $hotelRepository;
$this->productRepository = $productRepository;
$this->hotelDataService = $hotelDataService;
$this->productDataService = $productDataService;
} }
/** /**
@@ -14,27 +14,14 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
class MapController extends ActionController class MapController extends ActionController
{ {
/**
* @var HotelRepository
*/
protected $hotelRepository;
/**
* @var ProductRepository
*/
protected $productRepository;
/** /**
* @param HotelRepository $hotelRepository * @param HotelRepository $hotelRepository
* @param ProductRepository $productRepository * @param ProductRepository $productRepository
*/ */
public function __construct( public function __construct(
HotelRepository $hotelRepository, private readonly HotelRepository $hotelRepository,
ProductRepository $productRepository private readonly ProductRepository $productRepository,
) ) {
{
$this->hotelRepository = $hotelRepository;
$this->productRepository = $productRepository;
} }
public function generalAction(): ResponseInterface public function generalAction(): ResponseInterface
@@ -89,7 +76,7 @@ class MapController extends ActionController
* @param int $pageUid * @param int $pageUid
* @return string * @return string
*/ */
protected function getUriForPageUid($pageUid) private function getUriForPageUid($pageUid)
{ {
/** @var ContentObjectRenderer $contentObject */ /** @var ContentObjectRenderer $contentObject */
$contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class); $contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
@@ -20,36 +20,6 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class ProductController extends 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 ProductRepository $productRepository
* @param ProductDataService $productDataService * @param ProductDataService $productDataService
@@ -61,21 +31,15 @@ class ProductController extends ActionController
* @param PickupOverviewService $pickupOverviewService * @param PickupOverviewService $pickupOverviewService
*/ */
public function __construct( public function __construct(
ProductRepository $productRepository, private readonly ProductRepository $productRepository,
ProductDataService $productDataService, private readonly ProductDataService $productDataService,
HotelRepository $hotelRepository, private readonly HotelRepository $hotelRepository,
HotelDataService $hotelDataService, private readonly HotelDataService $hotelDataService,
DateService $dateService, private readonly DateService $dateService,
FilterService $filterService, private readonly FilterService $filterService,
private readonly InfoboxRepository $infoboxRepository, 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;
} }
/** /**
@@ -12,24 +12,14 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class RegionController extends ActionController class RegionController extends ActionController
{ {
/**
* @var RegionRepository
*/
protected $regionRepository;
/**
* @var ProductDataService
*/
protected $productDataService;
/** /**
* @param RegionRepository $regionRepository * @param RegionRepository $regionRepository
* @param ProductDataService $productDataService * @param ProductDataService $productDataService
*/ */
public function __construct(RegionRepository $regionRepository, ProductDataService $productDataService) public function __construct(
{ private readonly RegionRepository $regionRepository,
$this->regionRepository = $regionRepository; private readonly ProductDataService $productDataService,
$this->productDataService = $productDataService; ) {
} }
/** /**
@@ -22,17 +22,11 @@ class SearchController extends ActionController
*/ */
public const SEARCHBAR_PARAMETERS = ['dateFrom', 'dateTo', 'pax', 'destinationType', 'destinationUid', 'priceRange']; public const SEARCHBAR_PARAMETERS = ['dateFrom', 'dateTo', 'pax', 'destinationType', 'destinationUid', 'priceRange'];
/**
* @var FilterService
*/
protected $filterService;
/** /**
* @param FilterService $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() public function initializeSearchresultAction()
@@ -10,17 +10,11 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class TeamController extends ActionController class TeamController extends ActionController
{ {
/**
* @var TeammemberRepository
*/
protected $teammemberRepository;
/** /**
* @param TeammemberRepository $teammemberRepository * @param TeammemberRepository $teammemberRepository
*/ */
public function __construct(TeammemberRepository $teammemberRepository) public function __construct(private readonly TeammemberRepository $teammemberRepository)
{ {
$this->teammemberRepository = $teammemberRepository;
} }
public function listAction(): ResponseInterface public function listAction(): ResponseInterface
@@ -70,7 +70,7 @@ class TravelinfoController extends ActionController
// fetch travel data via API call // fetch travel data via API call
try { try {
$travelData = $this->apiClient->getTravel($travelCode); $travelData = $this->apiClient->getTravel($travelCode);
} catch (ApiException $e) { } catch (ApiException) {
$travelData = []; $travelData = [];
} }
@@ -19,67 +19,67 @@ class FilterOptions implements \JsonSerializable
/** /**
* @var array * @var array
*/ */
protected $priceRanges = []; private $priceRanges = [];
/** /**
* @var array * @var array
*/ */
protected $destinations = []; private $destinations = [];
/** /**
* @var array * @var array
*/ */
protected $concepts = []; private $concepts = [];
/** /**
* @var array * @var array
*/ */
protected $pax = []; private $pax = [];
/** /**
* @var array * @var array
*/ */
protected $nights = []; private $nights = [];
/** /**
* @var array * @var array
*/ */
protected $hotelTypes = []; private $hotelTypes = [];
/** /**
* @var array * @var array
*/ */
protected $boardTypes = []; private $boardTypes = [];
/** /**
* @var array * @var array
*/ */
protected $roomTypes = []; private $roomTypes = [];
/** /**
* @var \DateTime * @var \DateTime
*/ */
protected $dateFrom; private $dateFrom;
/** /**
* @var \DateTime * @var \DateTime
*/ */
protected $dateTo; private $dateTo;
/** /**
* @var bool * @var bool
*/ */
protected $busAvailable; private $busAvailable;
/** /**
* @var int * @var int
*/ */
protected $resultCount; private $resultCount;
/** /**
* @var string * @var string
*/ */
protected $resultsUri; private $resultsUri;
public function __construct() public function __construct()
{ {
@@ -5,18 +5,12 @@ namespace EP\EpProducts\Domain\Model;
class SearchResult class SearchResult
{ {
/**
* @var array
*/
protected $data = [];
/** /**
* @param array $data * @param array $data
* @param int $total * @param int $total
*/ */
public function __construct(array $data = [], protected $total = 0) public function __construct(private array $data = [], private $total = 0)
{ {
$this->data = $data;
} }
/** /**
@@ -201,7 +201,7 @@ class HotelRepository extends AbstractRepository
* @return QueryBuilder * @return QueryBuilder
* @throws \Doctrine\DBAL\DBALException * @throws \Doctrine\DBAL\DBALException
*/ */
protected function getQueryBuilder($excludeNonSearchable = true) private function getQueryBuilder($excludeNonSearchable = true)
{ {
$qb = $this->getDbConnection()->createQueryBuilder(); $qb = $this->getDbConnection()->createQueryBuilder();
@@ -6,7 +6,7 @@ class Services
/** /**
* @var array * @var array
*/ */
protected static $categoryLabels = [ private static $categoryLabels = [
'BUS' => 'Anreise', 'BUS' => 'Anreise',
'VPF' => 'Verpflegung', 'VPF' => 'Verpflegung',
'SPA' => 'Skipass', 'SPA' => 'Skipass',
@@ -63,37 +63,22 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
/** /**
* @var int * @var int
*/ */
protected $pid = 0; private $pid = 0;
/** /**
* @var array * @var array
*/ */
protected $hotelMappings = []; private $hotelMappings = [];
/** /**
* @var Connection * @var Connection
*/ */
protected $db; private $db;
/**
* @var CacheService
*/
protected $cacheService;
/**
* @var ProductImportSource
*/
protected $importSource;
/**
* @var RoomTypeResolver
*/
protected $roomTypeResolver;
/** /**
* @var array * @var array
*/ */
static protected $cache = [ static private $cache = [
'datesAdded' => [], 'datesAdded' => [],
]; ];
@@ -105,14 +90,10 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
*/ */
public function __construct( public function __construct(
ExtensionConfiguration $extensionConfiguration, ExtensionConfiguration $extensionConfiguration,
CacheService $cacheService, private CacheService $cacheService,
ProductImportSource $importSource, private ProductImportSource $importSource,
RoomTypeResolver $roomTypeResolver private RoomTypeResolver $roomTypeResolver
) { ) {
$this->cacheService = $cacheService;
$this->importSource = $importSource;
$this->roomTypeResolver = $roomTypeResolver;
// Extension configuration rather than TypoScript: the import runs on the CLI, where // Extension configuration rather than TypoScript: the import runs on the CLI, where
// TYPO3 13 has no frontend TypoScript (plugin.tx_epproducts.persistence.storagePid) // TYPO3 13 has no frontend TypoScript (plugin.tx_epproducts.persistence.storagePid)
$this->pid = (int)$extensionConfiguration->get('ep_products', 'importStoragePid'); $this->pid = (int)$extensionConfiguration->get('ep_products', 'importStoragePid');
@@ -152,7 +133,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param iterable<array> $rows * @param iterable<array> $rows
* @return int * @return int
*/ */
protected function importProducts(iterable $rows): int private function importProducts(iterable $rows): int
{ {
$products = []; $products = [];
foreach ($rows as $row) { foreach ($rows as $row) {
@@ -206,7 +187,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array[][] $dates rows grouped by travel date * @param array[][] $dates rows grouped by travel date
* @return int * @return int
*/ */
protected function importProduct(string $code, int $busProId, array $dates): int private function importProduct(string $code, int $busProId, array $dates): int
{ {
$dateCount = 0; $dateCount = 0;
@@ -258,7 +239,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $product * @param array $product
* @return int * @return int
*/ */
protected function importDate(array $rows, array $product): int private function importDate(array $rows, array $product): int
{ {
$dateCount = 0; $dateCount = 0;
@@ -306,7 +287,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $row * @param array $row
* @return array * @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']); $dateStart = \DateTime::createFromFormat('Y-m-d', $row['date']['from']);
$dateEnd = \DateTime::createFromFormat('Y-m-d', $row['date']['to']); $dateEnd = \DateTime::createFromFormat('Y-m-d', $row['date']['to']);
@@ -477,7 +458,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $date * @param array $date
* @return bool * @return bool
*/ */
protected function parseHotel(array $row, array &$date): bool private function parseHotel(array $row, array &$date): bool
{ {
$code = $row['hotel']['code']; $code = $row['hotel']['code'];
$busProId = (int) $row['hotel']['busProId']; $busProId = (int) $row['hotel']['busProId'];
@@ -526,7 +507,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $date * @param array $date
* @param array $services * @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; $minPriceOverall = 0.0;
$minPriceAvailable = 0.0; $minPriceAvailable = 0.0;
@@ -630,7 +611,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $services * @param array $services
* @return float * @return float
*/ */
protected function determineDiscount(array $services): float private function determineDiscount(array $services): float
{ {
foreach ($services as $key => $section) { foreach ($services as $key => $section) {
foreach ($section as $service) { foreach ($section as $service) {
@@ -649,7 +630,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param bool $skipWithoutPrice * @param bool $skipWithoutPrice
* @return array * @return array
*/ */
protected function parseService(array $services, bool $skipWithoutPrice = false): array private function parseService(array $services, bool $skipWithoutPrice = false): array
{ {
$data = []; $data = [];
foreach ($services as $service) { foreach ($services as $service) {
@@ -709,7 +690,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param int $busProId * @param int $busProId
* @return array * @return array
*/ */
protected function parseSelectionGroup(array $selectionGroups, int $busProId): array private function parseSelectionGroup(array $selectionGroups, int $busProId): array
{ {
$data = []; $data = [];
foreach ($selectionGroups as $group) { foreach ($selectionGroups as $group) {
@@ -727,7 +708,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array[] $selectionGroups * @param array[] $selectionGroups
* @return array * @return array
*/ */
protected function parsePersonnelSelectionGroup(array $selectionGroups): array private function parsePersonnelSelectionGroup(array $selectionGroups): array
{ {
$data = []; $data = [];
foreach ($selectionGroups as $group) { foreach ($selectionGroups as $group) {
@@ -753,7 +734,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $row * @param array $row
* @return bool * @return bool
*/ */
protected function isGroupTravel(array $row): bool private function isGroupTravel(array $row): bool
{ {
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER); $customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
$isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]); $isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]);
@@ -771,7 +752,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* *
* @param array $row * @param array $row
*/ */
protected function checkCustomerSelection(array $row): void private function checkCustomerSelection(array $row): void
{ {
$customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER); $customer = $this->parseSelectionGroup($row['selectionGroups'], static::SELECTION_GROUP_CUSTOMER);
$isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]); $isGroup = isset($customer[static::SELECTION_CUSTOMER_GROUP]);
@@ -793,7 +774,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array[] $selections * @param array[] $selections
* @param array $data * @param array $data
*/ */
protected function addSelections(array $selections, array &$data): void private function addSelections(array $selections, array &$data): void
{ {
foreach ($selections as $selection) { foreach ($selections as $selection) {
$data[(int) $selection['busProId']] = $selection['label']; $data[(int) $selection['busProId']] = $selection['label'];
@@ -804,7 +785,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $services * @param array $services
* @param array $date * @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)) { if (!array_key_exists('BUS', $services)) {
return; return;
@@ -827,7 +808,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param string $datetime * @param string $datetime
* @return string[] date as d.m.Y and time as H:i * @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)) { 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]]; return [$parts[3] . '.' . $parts[2] . '.' . $parts[1], $parts[4] . ':' . $parts[5]];
@@ -844,12 +825,12 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param string $price * @param string $price
* @return float * @return float
*/ */
protected function parseFormattedPrice(string $price): float private function parseFormattedPrice(string $price): float
{ {
return (float) str_replace(['.', ','], ['', '.'], $price); return (float) str_replace(['.', ','], ['', '.'], $price);
} }
protected function getHotelMappings(): void private function getHotelMappings(): void
{ {
$sql = ' $sql = '
SELECT u.code code, u.uid uid, h.name name, h.type type, 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 * @param int $uid
* @return string * @return string
*/ */
protected function getTopFactForRecord($table, $uid): string private function getTopFactForRecord($table, $uid): string
{ {
$sql = ' $sql = '
SELECT f.name SELECT f.name
@@ -911,7 +892,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
* @param array $services * @param array $services
* @param array $list * @param array $list
*/ */
protected function addServices(array $services, array &$list): void private function addServices(array $services, array &$list): void
{ {
foreach ($services as $key => $section) { foreach ($services as $key => $section) {
if (!array_key_exists($key, $list)) { if (!array_key_exists($key, $list)) {
@@ -14,30 +14,10 @@ use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
class DateService implements SingletonInterface class DateService implements SingletonInterface
{ {
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var FilterService
*/
protected $filterService;
/**
* @var DateRepository
*/
protected $dateRepository;
/**
* @var UriBuilder
*/
protected $uriBuilder;
/** /**
* @var string[] * @var string[]
*/ */
protected $serviceSections = [ private $serviceSections = [
'BUS' => 'Anreise', 'BUS' => 'Anreise',
'VPF' => 'Verpflegung', 'VPF' => 'Verpflegung',
'SPA' => 'Skipass', 'SPA' => 'Skipass',
@@ -64,18 +44,12 @@ class DateService implements SingletonInterface
* @param FilterService $filterService * @param FilterService $filterService
* @param UriBuilder $uriBuilder * @param UriBuilder $uriBuilder
*/ */
public function __construct public function __construct(
( private readonly ProductRepository $productRepository,
ProductRepository $productRepository, private readonly DateRepository $dateRepository,
DateRepository $dateRepository, private readonly FilterService $filterService,
FilterService $filterService, private readonly UriBuilder $uriBuilder,
UriBuilder $uriBuilder ) {
)
{
$this->productRepository = $productRepository;
$this->filterService = $filterService;
$this->dateRepository = $dateRepository;
$this->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->setRequired(['product', 'hotel', 'myEpUrl']);
$resolver->setDefined(['filterSettings', 'date', 'paCode']); $resolver->setDefined(['filterSettings', 'date', 'paCode']);
@@ -143,7 +117,7 @@ class DateService implements SingletonInterface
/** /**
* @param OptionsResolver $resolver * @param OptionsResolver $resolver
*/ */
protected function configureDatesTableOptions(OptionsResolver $resolver) private function configureDatesTableOptions(OptionsResolver $resolver)
{ {
$resolver->setDefined(['filterSettings']); $resolver->setDefined(['filterSettings']);
$resolver->setRequired(['product', 'hotel']); $resolver->setRequired(['product', 'hotel']);
@@ -321,7 +321,7 @@ class FilterService implements SingletonInterface
return $this->getNormalizedFilterSettings($filterSettings); return $this->getNormalizedFilterSettings($filterSettings);
} }
protected function getTypoScriptSettings(): ?array private function getTypoScriptSettings(): ?array
{ {
/** @var ConfigurationManager $configurationManager */ /** @var ConfigurationManager $configurationManager */
$configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
@@ -9,7 +9,7 @@ class FilterSettingsEncoder
/** /**
* @return array * @return array
*/ */
protected function getMapping() private function getMapping()
{ {
return [ return [
[ 'countryUids', 'array' ], [ 'countryUids', 'array' ],
@@ -10,24 +10,14 @@ use TYPO3\CMS\Core\SingletonInterface;
class HotelDataService implements SingletonInterface class HotelDataService implements SingletonInterface
{ {
/**
* @var HotelRepository
*/
protected $hotelRepository;
/**
* @var HotelImageService
*/
protected $hotelImageService;
/** /**
* @param HotelRepository $hotelRepository * @param HotelRepository $hotelRepository
* @param HotelImageService $hotelImageService * @param HotelImageService $hotelImageService
*/ */
public function __construct(HotelRepository $hotelRepository, HotelImageService $hotelImageService) public function __construct(
{ private readonly HotelRepository $hotelRepository,
$this->hotelRepository = $hotelRepository; private readonly HotelImageService $hotelImageService,
$this->hotelImageService = $hotelImageService; ) {
} }
/** /**
@@ -107,7 +97,7 @@ class HotelDataService implements SingletonInterface
* @param array $teaserData * @param array $teaserData
* @return array * @return array
*/ */
protected function preprocessTeaserData(array $teaserData) private function preprocessTeaserData(array $teaserData)
{ {
$teasers = []; $teasers = [];
foreach ($teaserData as $row) foreach ($teaserData as $row)
@@ -8,26 +8,6 @@ use TYPO3\CMS\Core\SingletonInterface;
class ProductDataService implements 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 ProductRepository $productRepository
* @param HotelRepository $hotelRepository * @param HotelRepository $hotelRepository
@@ -35,15 +15,11 @@ class ProductDataService implements SingletonInterface
* @param ProductImageService $productImageService * @param ProductImageService $productImageService
*/ */
public function __construct( public function __construct(
ProductRepository $productRepository, private readonly ProductRepository $productRepository,
HotelRepository $hotelRepository, private readonly HotelRepository $hotelRepository,
HotelImageService $hotelImageService, private readonly HotelImageService $hotelImageService,
ProductImageService $productImageService private readonly ProductImageService $productImageService,
) { ) {
$this->productRepository = $productRepository;
$this->hotelRepository = $hotelRepository;
$this->productImageService = $productImageService;
$this->hotelImageService = $hotelImageService;
} }
/** /**
@@ -19,17 +19,11 @@ class ResellerDataService implements SingletonInterface
{ {
use DbConnectionTrait; use DbConnectionTrait;
/**
* @var ProductRepository
*/
protected $productRepository;
/** /**
* @param ProductRepository $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 * @return array
* @throws \Doctrine\DBAL\DBALException * @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 = []; $data = [];
$products = $reseller->getProducts(); $products = $reseller->getProducts();
@@ -91,7 +91,7 @@ class RoomTypeResolver
* @param array $patterns * @param array $patterns
* @return bool * @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))); return array_any($patterns, fn($pattern) => str_contains(mb_strtolower($label), mb_strtolower($pattern)));
} }
@@ -15,35 +15,16 @@ class SearchResultService implements SingletonInterface
public const DESTINATION_TYPE_CITY = 'city'; public const DESTINATION_TYPE_CITY = 'city';
public const DESTINATION_TYPE_CONCEPT = 'concept'; public const DESTINATION_TYPE_CONCEPT = 'concept';
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @var HotelImageService
*/
protected $hotelImageService;
/**
* @var ProductImageService
*/
protected $productImageService;
/** /**
* @param ProductRepository $productRepository * @param ProductRepository $productRepository
* @param HotelImageService $hotelImageService * @param HotelImageService $hotelImageService
* @param ProductImageService $productImageService * @param ProductImageService $productImageService
*/ */
public function __construct( public function __construct(
ProductRepository $productRepository, private readonly ProductRepository $productRepository,
HotelImageService $hotelImageService, private readonly HotelImageService $hotelImageService,
ProductImageService $productImageService private readonly ProductImageService $productImageService,
) ) {
{
$this->productRepository = $productRepository;
$this->hotelImageService = $hotelImageService;
$this->productImageService = $productImageService;
} }
public function getNormalizedSearchParams(array $searchParams = []): array public function getNormalizedSearchParams(array $searchParams = []): array
@@ -14,12 +14,12 @@ class SerializationUtility
/** /**
* @var ImageService * @var ImageService
*/ */
protected static $imageService; private static $imageService;
/** /**
* @var ContentObjectRenderer * @var ContentObjectRenderer
*/ */
protected static $contentObject; private static $contentObject;
/** /**
* @param $text * @param $text
@@ -69,7 +69,7 @@ class SerializationUtility
/** /**
* @return ImageService * @return ImageService
*/ */
protected static function getImageService() private static function getImageService()
{ {
if (static::$imageService === null) { if (static::$imageService === null) {
static::$imageService = GeneralUtility::makeInstance(ImageService::class); static::$imageService = GeneralUtility::makeInstance(ImageService::class);
@@ -11,7 +11,7 @@ class SettingsUtility
/** /**
* @var array * @var array
*/ */
protected $settings = []; private $settings = [];
public function __construct() public function __construct()
{ {
@@ -20,7 +20,7 @@ class TypeConversionUtility
return (int) $value; return (int) $value;
} }
if (\is_array($value)) { if (\is_array($value)) {
return array_map(fn($item) => static::convertType($item), $value); return array_map(static::convertType(...), $value);
} }
if (empty($value)) { if (empty($value)) {
return null; return null;
@@ -74,7 +74,7 @@ class SliderProcessor implements DataProcessorInterface
/** /**
* @return null|int * @return null|int
*/ */
protected function getParentPageWithSlides() private function getParentPageWithSlides()
{ {
$rootlineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId()); $rootlineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId());
$rootline = $rootlineUtility->get(); $rootline = $rootlineUtility->get();
@@ -53,7 +53,7 @@ class OpenGraphMetaTagManager extends \TYPO3\CMS\Seo\MetaTag\OpenGraphMetaTagMan
/** /**
* @return null|int * @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 // The manager is also asked to render in the backend, where there is no frontend page
$pageInformation = $GLOBALS['TYPO3_REQUEST']?->getAttribute('frontend.page.information'); $pageInformation = $GLOBALS['TYPO3_REQUEST']?->getAttribute('frontend.page.information');
@@ -25,7 +25,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer
/** /**
* CType => [field holding the related uid, related table, template variable] * 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_country' => ['tx_eptheme_context_country', 'tx_epproducts_domain_model_country', 'country'],
'teaser_region' => ['tx_eptheme_context_region', 'tx_epproducts_domain_model_region', 'region'], 'teaser_region' => ['tx_eptheme_context_region', 'tx_epproducts_domain_model_region', 'region'],
'teaser_city' => ['tx_eptheme_context_city', 'tx_epproducts_domain_model_city', 'city'], 'teaser_city' => ['tx_eptheme_context_city', 'tx_epproducts_domain_model_city', 'city'],
@@ -63,7 +63,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer
return $view->render(); 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])) { if (isset(self::RELATED_RECORDS[$cType])) {
[$field, $table, $name] = self::RELATED_RECORDS[$cType]; [$field, $table, $name] = self::RELATED_RECORDS[$cType];
@@ -110,7 +110,7 @@ class ContentPreviewRenderer extends StandardContentPreviewRenderer
return []; return [];
} }
protected function getImages(int $uid, string $table, string $field): array private function getImages(int $uid, string $table, string $field): array
{ {
if ($uid <= 0) { if ($uid <= 0) {
return []; return [];
@@ -10,7 +10,7 @@ class ContainerViewHelper extends AbstractViewHelper
/** /**
* @var int[] * @var int[]
*/ */
protected static $scale = [ private static $scale = [
'default' => 0, 'default' => 0,
'small' => 8, 'small' => 8,
'large' => 16, 'large' => 16,
@@ -25,7 +25,7 @@ class ContainerViewHelper extends AbstractViewHelper
/** /**
* @var array * @var array
*/ */
protected static $columnsWithoutContainers = [ 0, 1, 3 ]; private static $columnsWithoutContainers = [ 0, 1, 3 ];
public function initializeArguments() public function initializeArguments()
{ {
@@ -33,7 +33,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper
return $this->tag->render(); return $this->tag->render();
} }
protected static function getImageService() private static function getImageService()
{ {
return GeneralUtility::makeInstance(ImageService::class); return GeneralUtility::makeInstance(ImageService::class);
} }