From 2b8312c32c1f6cabbd840d9768bfb9da822d2da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Thu, 4 Oct 2018 11:47:31 +0200 Subject: [PATCH] Code cleanup --- .../ep_events/Classes/Service/ConfigurationService.php | 2 +- .../ep_products/Classes/Controller/SearchController.php | 2 +- .../ext/ep_products/Classes/Service/FilterService.php | 2 +- .../ext/ep_products/Classes/Service/HotelDataService.php | 4 ++-- .../ep_products/Classes/Service/ProductDataService.php | 6 +++--- .../ep_products/Classes/Service/SearchResultService.php | 4 ++-- .../Traits/RequestArgumentTypeConversionTrait.php | 2 +- .../ep_theme/Classes/Controller/AjaxFormController.php | 9 +++++---- .../ep_theme/Classes/ViewHelpers/ContainerViewHelper.php | 2 +- 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/web/typo3conf/ext/ep_events/Classes/Service/ConfigurationService.php b/web/typo3conf/ext/ep_events/Classes/Service/ConfigurationService.php index 11fb4512..685c4e5f 100644 --- a/web/typo3conf/ext/ep_events/Classes/Service/ConfigurationService.php +++ b/web/typo3conf/ext/ep_events/Classes/Service/ConfigurationService.php @@ -50,7 +50,7 @@ class ConfigurationService $config = []; foreach (explode(';', $configArray[$itemName]['value']) as $item) { - list ($value, $label) = explode(':', $item); + [ $value, $label ] = explode(':', $item); $config[$value] = $label; } diff --git a/web/typo3conf/ext/ep_products/Classes/Controller/SearchController.php b/web/typo3conf/ext/ep_products/Classes/Controller/SearchController.php index d75a95f9..172499bf 100644 --- a/web/typo3conf/ext/ep_products/Classes/Controller/SearchController.php +++ b/web/typo3conf/ext/ep_products/Classes/Controller/SearchController.php @@ -139,7 +139,7 @@ class SearchController extends ActionController { $ignoreIps = GeneralUtility::trimExplode(',', $this->settings['searchLogIgnoreIps'], true); $remoteIp = GeneralUtility::getIndpEnv('REMOTE_ADDR'); - if (in_array($remoteIp, $ignoreIps)) { + if (\in_array($remoteIp, $ignoreIps, false)) { return; } /** @var $logger \TYPO3\CMS\Core\Log\Logger */ diff --git a/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php b/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php index 2657eba2..3f0f3196 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/FilterService.php @@ -126,7 +126,7 @@ class FilterService implements SingletonInterface // Nights $duration = (int) $row['nights'] <= 4 ? FilterSettings::DURATION_SHORT : FilterSettings::DURATION_LONG; - if (!in_array($duration, $nights)) { + if (!\in_array($duration, $nights, false)) { $nights[] = $duration; } diff --git a/web/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php b/web/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php index 21d93cb5..f774783e 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/HotelDataService.php @@ -247,11 +247,11 @@ class HotelDataService implements SingletonInterface $hotel['available'] += $row['available']; - if (!in_array($row['nights'], $hotel['nights'])) { + if (!\in_array($row['nights'], $hotel['nights'], false)) { $hotel['nights'][] = $row['nights']; } - if (!in_array($row['dateStart'], $hotel['dates'])) { + if (!\in_array($row['dateStart'], $hotel['dates'], false)) { $hotel['dates'][] = $row['dateStart']; } diff --git a/web/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php b/web/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php index 5291455f..c5c37414 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/ProductDataService.php @@ -125,11 +125,11 @@ class ProductDataService implements SingletonInterface $teaser =& $data[$row['productUid']]; - if (!in_array($row['nights'], $teaser['nights'])) { + if (!\in_array($row['nights'], $teaser['nights'], false)) { $teaser['nights'][] = $row['nights']; } - if (!in_array($row['dateStart'], $teaser['dates'])) { + if (!\in_array($row['dateStart'], $teaser['dates'], false)) { $teaser['dates'][] = $row['dateStart']; } @@ -167,7 +167,7 @@ class ProductDataService implements SingletonInterface } if ($limit > 0) { - return array_slice($data, 0, $limit); + return \array_slice($data, 0, $limit); } return $data; diff --git a/web/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php b/web/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php index cfc0b7de..95d16477 100644 --- a/web/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php +++ b/web/typo3conf/ext/ep_products/Classes/Service/SearchResultService.php @@ -156,11 +156,11 @@ class SearchResultService implements SingletonInterface $item =& $items[$key]; - if (!in_array($row['nights'], $item['nights'])) { + if (!\in_array($row['nights'], $item['nights'], false)) { $item['nights'][] = $row['nights']; } - if (!in_array($row['dateStart'], $item['dates'])) { + if (!\in_array($row['dateStart'], $item['dates'], false)) { $item['dates'][] = $row['dateStart']; } diff --git a/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php b/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php index 30bc5327..0e020575 100644 --- a/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php +++ b/web/typo3conf/ext/ep_products/Classes/Traits/RequestArgumentTypeConversionTrait.php @@ -95,7 +95,7 @@ trait RequestArgumentTypeConversionTrait $filterSettings['dateTo'] = !empty($filterSettings['dateTo']) ? new \DateTime($filterSettings['dateTo']) : null; if (!empty($filterSettings['bus'])) { - $filterSettings['bus'] = in_array($filterSettings['bus'], [ 'true', '1' ], true); + $filterSettings['bus'] = \in_array($filterSettings['bus'], [ 'true', '1' ], true); } else { $filterSettings['bus'] = null; } diff --git a/web/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php b/web/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php index 7c6d2621..cfc011fd 100644 --- a/web/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php +++ b/web/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php @@ -40,11 +40,12 @@ class AjaxFormController extends ActionController protected $emailService; /** - * @param EmailService $service + * @param EmailService $emailService */ - public function injectEmailService(EmailService $service) + public function __construct(EmailService $emailService) { - $this->emailService = $service; + parent::__construct(); + $this->emailService = $emailService; } /** @@ -73,7 +74,7 @@ class AjaxFormController extends ActionController if ($this->arguments->getValidationResults()->hasErrors()) { foreach ($this->arguments->getValidationResults()->getFlattenedErrors() as $key => $errors) { - list($formName, $fieldName) = explode('.', $key); + [ $formName, $fieldName ] = explode('.', $key); $errorsRaw = []; foreach ($errors as $error) { diff --git a/web/typo3conf/ext/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php b/web/typo3conf/ext/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php index 448978e5..629cf53a 100644 --- a/web/typo3conf/ext/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php +++ b/web/typo3conf/ext/ep_theme/Classes/ViewHelpers/ContainerViewHelper.php @@ -73,7 +73,7 @@ class ContainerViewHelper extends AbstractViewHelper } $classes = []; - if (in_array($arguments['data']['colPos'], static::$columnsWithoutContainers, false)) { + if (\in_array($arguments['data']['colPos'], static::$columnsWithoutContainers, false)) { $classes[] = 'container'; } else { $classes[] = 'in-column';