[CLEANUP] Replace count with empty in EXT:documentation 88/40688/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Jun 2015 13:53:01 +0000 (15:53 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 27 Jun 2015 14:36:24 +0000 (16:36 +0200)
Replace occurences of count() with matching empty() pendants.

Resolves: #67780
Releases: master
Change-Id: I5239a038aeeaf47d656f3767ce56db61901a69e6
Reviewed-on: http://review.typo3.org/40688
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/documentation/Classes/Controller/DocumentController.php
typo3/sysext/documentation/Classes/Domain/Repository/DocumentRepository.php
typo3/sysext/documentation/Classes/Service/DocumentationService.php

index 57784c9..9fabb86 100644 (file)
@@ -65,12 +65,12 @@ class DocumentController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
                // Filter documents to be shown for current user
                $hideDocuments = $this->getBackendUser()->getTSConfigVal('mod.help_DocumentationDocumentation.documents.hide');
                $hideDocuments = GeneralUtility::trimExplode(',', $hideDocuments, TRUE);
-               if (count($hideDocuments) > 0) {
+               if (!empty($hideDocuments)) {
                        $documents = array_diff_key($documents, array_flip($hideDocuments));
                }
                $showDocuments = $this->getBackendUser()->getTSConfigVal('mod.help_DocumentationDocumentation.documents.show');
                $showDocuments = GeneralUtility::trimExplode(',', $showDocuments, TRUE);
-               if (count($showDocuments) > 0) {
+               if (!empty($showDocuments)) {
                        $documents = array_intersect_key($documents, array_flip($showDocuments));
                }
 
index 7825ff8..20ad2b5 100644 (file)
@@ -172,7 +172,7 @@ class DocumentRepository {
                                                case 'pdf':
                                                        // Retrieve first PDF
                                                        $files = GeneralUtility::getFilesInDir(PATH_site . $formatPath . $format, 'pdf');
-                                                       if (count($files) > 0) {
+                                                       if (is_array($files) && !empty($files)) {
                                                                $documentFile = current($files);
                                                        }
                                                        break;
@@ -187,7 +187,7 @@ class DocumentRepository {
                                        }
                                }
 
-                               if (count($documentTranslation->getFormats()) > 0) {
+                               if (!empty($documentTranslation->getFormats())) {
                                        $document->addTranslation($documentTranslation);
                                        $documents[$documentKey] = $document;
                                }
index b8fa141..58cc329 100644 (file)
@@ -100,7 +100,7 @@ class DocumentationService {
                $success = FALSE;
 
                $packages = $this->getAvailablePackages($url);
-               if (count($packages) == 0) {
+               if (empty($packages)) {
                        return $success;
                }
 
@@ -166,7 +166,7 @@ class DocumentationService {
                $absolutePathToZipFile = GeneralUtility::getFileAbsFileName('typo3temp/' . $packageName);
 
                $packages = $this->getAvailablePackages($url);
-               if (count($packages) == 0 || !isset($packages[$version][$language])) {
+               if (empty($packages) || !isset($packages[$version][$language])) {
                        return FALSE;
                }