From 7f2249e3ffbdb643376677b6146b63b998b142c3 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sun, 30 Dec 2018 14:00:22 +0100 Subject: [PATCH] TASK: Use a single array utility Instead of only adding a new class for one static method, we extend the existing class to only import a single class. This way we extend the original array utility function collection. --- Classes/Configuration/ConfigurationContainer.php | 2 +- Classes/Domain/Model/SearchRequest.php | 5 ++--- Classes/Domain/Search/QueryFactory.php | 2 +- Classes/Domain/Search/SearchService.php | 2 +- Classes/Utility/ArrayUtility.php | 4 +++- Documentation/source/development/configuration.rst | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Classes/Configuration/ConfigurationContainer.php b/Classes/Configuration/ConfigurationContainer.php index b213c9b..9917f12 100644 --- a/Classes/Configuration/ConfigurationContainer.php +++ b/Classes/Configuration/ConfigurationContainer.php @@ -21,7 +21,7 @@ namespace Codappix\SearchCore\Configuration; * 02110-1301, USA. */ -use TYPO3\CMS\Core\Utility\ArrayUtility; +use Codappix\SearchCore\Utility\ArrayUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; /** diff --git a/Classes/Domain/Model/SearchRequest.php b/Classes/Domain/Model/SearchRequest.php index 0d8865b..32efb5d 100644 --- a/Classes/Domain/Model/SearchRequest.php +++ b/Classes/Domain/Model/SearchRequest.php @@ -26,8 +26,7 @@ use Codappix\SearchCore\Connection\FacetRequestInterface; use Codappix\SearchCore\Connection\SearchRequestInterface; use Codappix\SearchCore\Connection\SearchResultInterface; use Codappix\SearchCore\Domain\Search\SearchServiceInterface; -use Codappix\SearchCore\Utility\ArrayUtility as CustomArrayUtility; -use TYPO3\CMS\Core\Utility\ArrayUtility; +use Codappix\SearchCore\Utility\ArrayUtility; /** * Represents a search request used to process an actual search. @@ -99,7 +98,7 @@ class SearchRequest implements SearchRequestInterface public function setFilter(array $filter) { $filter = ArrayUtility::removeArrayEntryByValue($filter, ''); - $this->filter = CustomArrayUtility::removeEmptyElementsRecursively($filter); + $this->filter = ArrayUtility::removeEmptyElementsRecursively($filter); } public function hasFilter(): bool diff --git a/Classes/Domain/Search/QueryFactory.php b/Classes/Domain/Search/QueryFactory.php index f34befc..c7565b1 100644 --- a/Classes/Domain/Search/QueryFactory.php +++ b/Classes/Domain/Search/QueryFactory.php @@ -25,7 +25,7 @@ use Codappix\SearchCore\Configuration\ConfigurationContainerInterface; use Codappix\SearchCore\Configuration\ConfigurationUtility; use Codappix\SearchCore\Configuration\InvalidArgumentException; use Codappix\SearchCore\Connection\SearchRequestInterface; -use TYPO3\CMS\Core\Utility\ArrayUtility; +use Codappix\SearchCore\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; use TYPO3\CMS\Extbase\Utility\DebuggerUtility; diff --git a/Classes/Domain/Search/SearchService.php b/Classes/Domain/Search/SearchService.php index fedf09e..43b54b8 100644 --- a/Classes/Domain/Search/SearchService.php +++ b/Classes/Domain/Search/SearchService.php @@ -29,7 +29,7 @@ use Codappix\SearchCore\Connection\SearchResultInterface; use Codappix\SearchCore\DataProcessing\Service as DataProcessorService; use Codappix\SearchCore\Domain\Model\FacetRequest; use Codappix\SearchCore\Domain\Model\SearchResult; -use TYPO3\CMS\Core\Utility\ArrayUtility; +use Codappix\SearchCore\Utility\ArrayUtility; use TYPO3\CMS\Extbase\Object\ObjectManagerInterface; /** diff --git a/Classes/Utility/ArrayUtility.php b/Classes/Utility/ArrayUtility.php index 91e9e47..29815b1 100644 --- a/Classes/Utility/ArrayUtility.php +++ b/Classes/Utility/ArrayUtility.php @@ -21,7 +21,9 @@ namespace Codappix\SearchCore\Utility; * 02110-1301, USA. */ -class ArrayUtility +use TYPO3\CMS\Core\Utility\ArrayUtility as Typo3ArrayUtility; + +class ArrayUtility extends Typo3ArrayUtility { /** * Recursively removes empty array elements. diff --git a/Documentation/source/development/configuration.rst b/Documentation/source/development/configuration.rst index ba976c7..e9827ff 100644 --- a/Documentation/source/development/configuration.rst +++ b/Documentation/source/development/configuration.rst @@ -25,7 +25,7 @@ SearchCoreConfigurationContainer.php:: use Codappix\SearchCore\Configuration\ConfigurationContainer; use Codappix\SearchCore\Configuration\NoConfigurationException; - use TYPO3\CMS\Core\Utility\ArrayUtility; + use Codappix\SearchCore\Utility\ArrayUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; /**