Add return types, cleanup code
This commit is contained in:
@@ -77,7 +77,7 @@ class DateCommandController extends Command
|
|||||||
* @param OutputInterface $output
|
* @param OutputInterface $output
|
||||||
* @throws \Doctrine\DBAL\DBALException
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
|
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
|
||||||
$count = $this->dateImportService->import($path);
|
$count = $this->dateImportService->import($path);
|
||||||
@@ -92,7 +92,7 @@ class DateCommandController extends Command
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getSettings()
|
protected function getSettings(): array
|
||||||
{
|
{
|
||||||
$settings = $this
|
$settings = $this
|
||||||
->configurationManager
|
->configurationManager
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class ProductController extends ActionController
|
|||||||
Hotel $hotel = null,
|
Hotel $hotel = null,
|
||||||
$dateFrom = null,
|
$dateFrom = null,
|
||||||
$dateTo = null
|
$dateTo = null
|
||||||
) {
|
): void {
|
||||||
// Get product to display from flexform settings if not provided via url
|
// Get product to display from flexform settings if not provided via url
|
||||||
if ($product === null) {
|
if ($product === null) {
|
||||||
$productUid = $this->settings['productUid'];
|
$productUid = $this->settings['productUid'];
|
||||||
@@ -186,7 +186,7 @@ class ProductController extends ActionController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pricetableAction()
|
public function pricetableAction(): void
|
||||||
{
|
{
|
||||||
$productUid = $this->settings['productUid'];
|
$productUid = $this->settings['productUid'];
|
||||||
/** @var \EP\EpProducts\Domain\Model\Product $product */
|
/** @var \EP\EpProducts\Domain\Model\Product $product */
|
||||||
@@ -205,7 +205,7 @@ class ProductController extends ActionController
|
|||||||
/**
|
/**
|
||||||
* @param Product $product
|
* @param Product $product
|
||||||
*/
|
*/
|
||||||
public function hotelListAction(Product $product)
|
public function hotelListAction(Product $product): void
|
||||||
{
|
{
|
||||||
$hotels = $this->hotelDataService->getList($product);
|
$hotels = $this->hotelDataService->getList($product);
|
||||||
$this->view->assignMultiple([
|
$this->view->assignMultiple([
|
||||||
@@ -215,7 +215,7 @@ class ProductController extends ActionController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function teasergroupAction()
|
public function teasergroupAction(): void
|
||||||
{
|
{
|
||||||
$filterSettings = $this->filterService->getFiltersettingsFromSettings($this->settings);
|
$filterSettings = $this->filterService->getFiltersettingsFromSettings($this->settings);
|
||||||
$dateAuto = !$this->settings['dateFrom'] && !$this->settings['dateTo'];
|
$dateAuto = !$this->settings['dateFrom'] && !$this->settings['dateTo'];
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ class ProductDataService implements SingletonInterface
|
|||||||
HotelRepository $hotelRepository,
|
HotelRepository $hotelRepository,
|
||||||
HotelImageService $hotelImageService,
|
HotelImageService $hotelImageService,
|
||||||
ProductImageService $productImageService
|
ProductImageService $productImageService
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
$this->productRepository = $productRepository;
|
$this->productRepository = $productRepository;
|
||||||
$this->hotelRepository = $hotelRepository;
|
$this->hotelRepository = $hotelRepository;
|
||||||
$this->productImageService = $productImageService;
|
$this->productImageService = $productImageService;
|
||||||
@@ -78,10 +77,11 @@ class ProductDataService implements SingletonInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTeaser(array $filterSettings)
|
public function getTeaser(array $filterSettings): array
|
||||||
{
|
{
|
||||||
$teaserData = $this->productRepository->getTeasers($filterSettings);
|
$teaserData = $this->productRepository->getTeasers($filterSettings);
|
||||||
$teasers = $this->preprocessTeasergroup($teaserData);
|
$teasers = $this->preprocessTeasergroup($teaserData);
|
||||||
|
|
||||||
return reset($teasers);
|
return reset($teasers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +92,10 @@ class ProductDataService implements SingletonInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getTeasergroup(array $filterSettings, $excludedConceptUids = [], $limit = 0)
|
public function getTeasergroup(array $filterSettings, array $excludedConceptUids = [], int $limit = 0): array
|
||||||
{
|
{
|
||||||
$teaserData = $this->productRepository->getTeasers($filterSettings, $excludedConceptUids);
|
$teaserData = $this->productRepository->getTeasers($filterSettings, $excludedConceptUids);
|
||||||
|
|
||||||
return $this->preprocessTeasergroup($teaserData, $limit);
|
return $this->preprocessTeasergroup($teaserData, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,12 +105,11 @@ class ProductDataService implements SingletonInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function preprocessTeasergroup(array $teaserData, $limit = 0)
|
public function preprocessTeasergroup(array $teaserData, int $limit = 0): array
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
foreach ($teaserData as $row)
|
foreach ($teaserData as $row) {
|
||||||
{
|
|
||||||
if (!array_key_exists($row['productUid'], $data)) {
|
if (!array_key_exists($row['productUid'], $data)) {
|
||||||
$data[$row['productUid']] = $this->createTeaserData($row);
|
$data[$row['productUid']] = $this->createTeaserData($row);
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ class ProductDataService implements SingletonInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function createTeaserData(array $teaserData)
|
public function createTeaserData(array $teaserData): array
|
||||||
{
|
{
|
||||||
$hotelCategory = Hotel::$categoryLabels[$teaserData['hotelCategory']] ?? null;
|
$hotelCategory = Hotel::$categoryLabels[$teaserData['hotelCategory']] ?? null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user