[CLEANUP] Replace count with empty in EXT:extensionmanager 89/40689/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Jun 2015 13:57:56 +0000 (15:57 +0200)
committerBenjamin Mack <benni@typo3.org>
Mon, 29 Jun 2015 21:46:54 +0000 (23:46 +0200)
Replace occurences of count() with matching empty() pendants.

Resolves: #67781
Releases: master
Change-Id: I4279ab12911ff7aa82c42e5a8bc2875c6e41f299
Reviewed-on: http://review.typo3.org/40689
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Classes/Domain/Repository/ConfigurationItemRepository.php
typo3/sysext/extensionmanager/Classes/Report/ExtensionStatus.php
typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php
typo3/sysext/extensionmanager/Classes/Utility/DatabaseUtility.php
typo3/sysext/extensionmanager/Classes/Utility/Importer/ExtensionListUtility.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php

index 3adebe9..8fcd0f4 100644 (file)
@@ -73,7 +73,7 @@ class DownloadController extends AbstractController {
                $hasErrors = FALSE;
                try {
                        $dependencyTypes = $this->managementService->getAndResolveDependencies($extension);
-                       if (count($dependencyTypes) > 0) {
+                       if (!empty($dependencyTypes)) {
                                $hasDependencies = TRUE;
                                $message = '<p>' . $this->translate('downloadExtension.dependencies.headline') . '</p>';
                                foreach ($dependencyTypes as $dependencyType => $dependencies) {
index c66e4eb..39b276e 100644 (file)
@@ -53,7 +53,7 @@ class ConfigurationItemRepository {
                $defaultConfiguration = $configurationUtility->getDefaultConfigurationFromExtConfTemplateAsValuedArray($extensionKey);
 
                $resultArray = array();
-               if (count($defaultConfiguration) > 0) {
+               if (!empty($defaultConfiguration)) {
                        $metaInformation = $this->addMetaInformation($defaultConfiguration);
                        $configuration = $this->mergeWithExistingConfiguration($defaultConfiguration, $extensionKey);
                        $hierarchicConfiguration = array();
index dd5e1e7..70c1bef 100644 (file)
@@ -173,7 +173,7 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
 
                $result = new \stdClass();
 
-               if (count($loadedInsecure) === 0) {
+               if (empty($loadedInsecure)) {
                        $value = $this->languageService->getLL('report.status.loadedExtensions.noInsecureExtensionLoaded.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
@@ -204,7 +204,7 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
                        $severity
                );
 
-               if (count($existingInsecure) === 0) {
+               if (empty($existingInsecure)) {
                        $value = $this->languageService->getLL('report.status.existingExtensions.noInsecureExtensionExists.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
@@ -235,7 +235,7 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
                        $severity
                );
 
-               if (count($loadedOutdated) === 0) {
+               if (empty($loadedOutdated)) {
                        $value = $this->languageService->getLL('report.status.loadedOutdatedExtensions.noOutdatedExtensionLoaded.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
@@ -266,7 +266,7 @@ class ExtensionStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
                        $severity
                );
 
-               if (count($existingOutdated) === 0) {
+               if (empty($existingOutdated)) {
                        $value = $this->languageService->getLL('report.status.existingOutdatedExtensions.noOutdatedExtensionExists.value');
                        $message = '';
                        $severity = \TYPO3\CMS\Reports\Status::OK;
index fd4e030..7a4235e 100644 (file)
@@ -154,7 +154,7 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
                $queue = $this->downloadQueue->getExtensionQueue();
                $copyQueue = $this->downloadQueue->getExtensionCopyStorage();
 
-               if (count($copyQueue) > 0) {
+               if (!empty($copyQueue)) {
                        $this->copyDependencies($copyQueue);
                }
                $downloadedDependencies = array();
@@ -169,7 +169,7 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
                        // add extension at the end of the download queue
                        $this->downloadQueue->addExtensionToInstallQueue($extension);
                        $installQueue = $this->downloadQueue->getExtensionInstallStorage();
-                       if (count($installQueue) > 0) {
+                       if (!empty($installQueue)) {
                                $installedDependencies = $this->installDependencies($installQueue);
                        }
                }
@@ -326,7 +326,7 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
                $this->dependencyUtility->setSkipSystemDependencyCheck($this->skipSystemDependencyCheck);
                $this->dependencyUtility->checkDependencies($extension);
                $installQueue = $this->downloadQueue->getExtensionInstallStorage();
-               if (is_array($installQueue) && count($installQueue) > 0) {
+               if (is_array($installQueue) && !empty($installQueue)) {
                        $installQueue = array('install' => $installQueue);
                }
                return array_merge($this->downloadQueue->getExtensionQueue(), $installQueue);
index e913527..53267dd 100644 (file)
@@ -86,7 +86,7 @@ class DatabaseUtility implements \TYPO3\CMS\Core\SingletonInterface {
                        }
                }
                // Compile final output:
-               if (count($lines)) {
+               if (!empty($lines)) {
                        $dump = trim('
 #
 # Table structure for table "' . $table . '"
index d5fcc9d..5b024bf 100644 (file)
@@ -146,7 +146,7 @@ class ExtensionListUtility implements \SplObserver {
                $this->sumRecords = 0;
                $this->parser->parseXML($zlibStream . $localExtensionListFile);
                // flush last rows to database if existing
-               if (count($this->arrRows)) {
+               if (!empty($this->arrRows)) {
                        $GLOBALS['TYPO3_DB']->exec_INSERTmultipleRows('tx_extensionmanager_domain_model_extension', self::$fieldNames, $this->arrRows, self::$fieldIndicesNoQuote);
                }
                $extensions = $this->extensionRepository->insertLastVersion($this->repositoryUid);
index 433d26d..c0b337d 100644 (file)
@@ -125,7 +125,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
         */
        public function uninstall($extensionKey) {
                $dependentExtensions = $this->dependencyUtility->findInstalledExtensionsThatDependOnMe($extensionKey);
-               if (is_array($dependentExtensions) && count($dependentExtensions) > 0) {
+               if (is_array($dependentExtensions) && !empty($dependentExtensions)) {
                        throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(
                                \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
                                        'extensionList.uninstall.dependencyError',
@@ -324,7 +324,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
         */
        public function updateDbWithExtTablesSql($rawDefinitions) {
                $fieldDefinitionsFromFile = $this->installToolSqlParser->getFieldDefinitions_fileContent($rawDefinitions);
-               if (count($fieldDefinitionsFromFile)) {
+               if (!empty($fieldDefinitionsFromFile)) {
                        $fieldDefinitionsFromCurrentDatabase = $this->installToolSqlParser->getFieldDefinitions_database();
                        $diff = $this->installToolSqlParser->getDatabaseExtra($fieldDefinitionsFromFile, $fieldDefinitionsFromCurrentDatabase);
                        $updateStatements = $this->installToolSqlParser->getUpdateSuggestions($diff);