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