[CLEANUP] Replace count with empty in EXT:core 86/40686/5
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Jun 2015 12:18:11 +0000 (14:18 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 1 Jul 2015 01:15:37 +0000 (03:15 +0200)
Replace occurences of count() with matching empty() pendants.

Resolves: #67778
Releases: master
Change-Id: I16c0299db8afda4c0fe406f7465a41d5eee3dd88
Reviewed-on: http://review.typo3.org/40686
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Tested-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
58 files changed:
typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Classes/Cache/Backend/ApcBackend.php
typo3/sysext/core/Classes/Cache/Backend/FileBackend.php
typo3/sysext/core/Classes/Cache/Backend/MemcachedBackend.php
typo3/sysext/core/Classes/Cache/Backend/RedisBackend.php
typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php
typo3/sysext/core/Classes/Cache/Backend/WincacheBackend.php
typo3/sysext/core/Classes/Cache/Backend/XcacheBackend.php
typo3/sysext/core/Classes/Cache/CacheManager.php
typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php
typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php
typo3/sysext/core/Classes/Controller/CommandLineController.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Database/DatabaseConnection.php
typo3/sysext/core/Classes/Database/PreparedStatement.php
typo3/sysext/core/Classes/Database/QueryView.php
typo3/sysext/core/Classes/Database/RelationHandler.php
typo3/sysext/core/Classes/Database/SoftReferenceIndex.php
typo3/sysext/core/Classes/Database/SqlParser.php
typo3/sysext/core/Classes/Error/DebugExceptionHandler.php
typo3/sysext/core/Classes/ExtDirect/ExtDirectApi.php
typo3/sysext/core/Classes/ExtDirect/ExtDirectDebug.php
typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php
typo3/sysext/core/Classes/Html/HtmlParser.php
typo3/sysext/core/Classes/Html/RteHtmlParser.php
typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php
typo3/sysext/core/Classes/Resource/Folder.php
typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php
typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php
typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
typo3/sysext/core/Classes/Resource/ResourceFactory.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Classes/Resource/Service/UserFileInlineLabelService.php
typo3/sysext/core/Classes/Resource/Service/UserFileMountService.php
typo3/sysext/core/Classes/Service/AbstractService.php
typo3/sysext/core/Classes/TimeTracker/TimeTracker.php
typo3/sysext/core/Classes/Tree/TableConfiguration/DatabaseTreeDataProvider.php
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
typo3/sysext/core/Classes/TypoScript/TemplateService.php
typo3/sysext/core/Classes/Utility/ArrayUtility.php
typo3/sysext/core/Classes/Utility/ClientUtility.php
typo3/sysext/core/Classes/Utility/CommandUtility.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Classes/Utility/RootlineUtility.php
typo3/sysext/core/Tests/Functional/DataHandling/IRRE/AbstractTestCase.php
typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php
typo3/sysext/core/Tests/Unit/Resource/Index/ExtractorRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php

index 05a76b7..b47a676 100644 (file)
@@ -661,15 +661,15 @@ abstract class AbstractUserAuthentication {
                        if ($this->writeDevLog && $serviceChain) {
                                GeneralUtility::devLog($subType . ' auth services called: ' . $serviceChain, \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class);
                        }
-                       if ($this->writeDevLog && !count($tempuserArr)) {
+                       if ($this->writeDevLog && empty($tempuserArr)) {
                                GeneralUtility::devLog('No user found by services', \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class);
                        }
-                       if ($this->writeDevLog && count($tempuserArr)) {
+                       if ($this->writeDevLog && !empty($tempuserArr)) {
                                GeneralUtility::devLog(count($tempuserArr) . ' user records found by services', \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class);
                        }
                }
                // If no new user was set we use the already found user session
-               if (!count($tempuserArr) && $haveSession) {
+               if (empty($tempuserArr) && $haveSession) {
                        $tempuserArr[] = $authInfo['userSession'];
                        $tempuser = $authInfo['userSession'];
                        // User is authenticated because we found a user session
@@ -686,7 +686,7 @@ abstract class AbstractUserAuthentication {
                        }
                }
                // Authenticate the user if needed
-               if (count($tempuserArr) && !$authenticated) {
+               if (!empty($tempuserArr) && !$authenticated) {
                        foreach ($tempuserArr as $tempuser) {
                                // Use 'auth' service to authenticate the user
                                // If one service returns FALSE then authentication failed
@@ -770,12 +770,12 @@ abstract class AbstractUserAuthentication {
                                        \TYPO3\CMS\Core\Utility\HttpUtility::redirect('http://' . $server . '/' . $address . TYPO3_mainDir . $backendScript);
                                }
                        }
-               } elseif ($activeLogin || count($tempuserArr)) {
+               } elseif ($activeLogin || !empty($tempuserArr)) {
                        $this->loginFailure = TRUE;
-                       if ($this->writeDevLog && !count($tempuserArr) && $activeLogin) {
+                       if ($this->writeDevLog && empty($tempuserArr) && $activeLogin) {
                                GeneralUtility::devLog('Login failed: ' . GeneralUtility::arrayToLogString($loginData), \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class, 2);
                        }
-                       if ($this->writeDevLog && count($tempuserArr)) {
+                       if ($this->writeDevLog && !empty($tempuserArr)) {
                                GeneralUtility::devLog('Login failed: ' . GeneralUtility::arrayToLogString($tempuser, array($this->userid_column, $this->username_column)), \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class, 2);
                        }
                }
index 523baca..7090b0d 100644 (file)
@@ -563,11 +563,8 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
                if (!is_object($RTE)) {
                        $this->RTE_errors = array_merge($this->RTE_errors, $RTE);
                }
-               if (!count($this->RTE_errors)) {
-                       return TRUE;
-               } else {
-                       return FALSE;
-               }
+
+               return empty($this->RTE_errors);
        }
 
        /**
index 935db23..69c4ab5 100644 (file)
@@ -298,7 +298,7 @@ class ApcBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend implement
                        // anywhere.
                        if (($key = array_search($entryIdentifier, $identifiers)) !== FALSE) {
                                unset($identifiers[$key]);
-                               if (count($identifiers)) {
+                               if (!empty($identifiers)) {
                                        apc_store($this->getIdentifierPrefix() . 'tag_' . $tag, $identifiers);
                                } else {
                                        apc_delete($this->getIdentifierPrefix() . 'tag_' . $tag);
index cafc280..3eaee7f 100644 (file)
@@ -297,7 +297,7 @@ class FileBackend extends \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend implem
         */
        public function flushByTag($tag) {
                $identifiers = $this->findIdentifiersByTag($tag);
-               if (count($identifiers) === 0) {
+               if (empty($identifiers)) {
                        return;
                }
                foreach ($identifiers as $entryIdentifier) {
index 2b0759c..a34076b 100644 (file)
@@ -130,7 +130,7 @@ class MemcachedBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend imp
         * @throws \TYPO3\CMS\Core\Cache\Exception
         */
        public function initializeObject() {
-               if (!count($this->servers)) {
+               if (empty($this->servers)) {
                        throw new \TYPO3\CMS\Core\Cache\Exception('No servers were given to Memcache', 1213115903);
                }
                $this->memcache = new \Memcache();
@@ -361,7 +361,7 @@ class MemcachedBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend imp
                        // anywhere.
                        if (($key = array_search($entryIdentifier, $identifiers)) !== FALSE) {
                                unset($identifiers[$key]);
-                               if (count($identifiers)) {
+                               if (!empty($identifiers)) {
                                        $this->memcache->set($this->identifierPrefix . 'tag_' . $tag, $identifiers);
                                } else {
                                        $this->memcache->delete($this->identifierPrefix . 'tag_' . $tag, 0);
index eb4196d..4bff5cc 100644 (file)
@@ -287,7 +287,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface {
                                $addTags = array_diff($tags, $existingTags);
                                $removeTags = array_diff($existingTags, $tags);
                        }
-                       if (count($removeTags) > 0 || count($addTags) > 0) {
+                       if (!empty($removeTags) || !empty($addTags)) {
                                $queue = $this->redis->multi(\Redis::PIPELINE);
                                foreach ($removeTags as $tag) {
                                        $queue->sRemove(self::IDENTIFIER_TAGS_PREFIX . $entryIdentifier, $tag);
@@ -428,7 +428,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface {
                }
                if ($this->connected) {
                        $identifiers = $this->redis->sMembers(self::TAG_IDENTIFIERS_PREFIX . $tag);
-                       if (count($identifiers) > 0) {
+                       if (!empty($identifiers)) {
                                $this->removeIdentifierEntriesAndRelations($identifiers, array($tag));
                        }
                }
index 3fa3fe4..37d8a85 100644 (file)
@@ -146,7 +146,7 @@ class Typo3DatabaseBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend
                        'expires' => $expires,
                        'content' => $data
                ));
-               if (count($tags)) {
+               if (!empty($tags)) {
                        $fields = array();
                        $fields[] = 'identifier';
                        $fields[] = 'tag';
index 565000b..ca5962a 100644 (file)
@@ -232,7 +232,7 @@ class WincacheBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend impl
                        // anywhere.
                        if (($key = array_search($entryIdentifier, $identifiers)) !== FALSE) {
                                unset($identifiers[$key]);
-                               if (count($identifiers)) {
+                               if (!empty($identifiers)) {
                                        wincache_ucache_set($this->identifierPrefix . 'tag_' . $tag, $identifiers);
                                } else {
                                        wincache_ucache_delete($this->identifierPrefix . 'tag_' . $tag);
index 302d5b7..af914e2 100644 (file)
@@ -270,7 +270,7 @@ class XcacheBackend extends AbstractBackend implements TaggableBackendInterface
                        // anywhere.
                        if (($key = array_search($entryIdentifier, $identifiers)) !== FALSE) {
                                unset($identifiers[$key]);
-                               if (count($identifiers)) {
+                               if (!empty($identifiers)) {
                                        xcache_set($this->identifierPrefix . 'tag_' . $tag, $identifiers);
                                } else {
                                        xcache_unset($this->identifierPrefix . 'tag_' . $tag);
index cb5b425..2194cd4 100644 (file)
@@ -250,13 +250,13 @@ class CacheManager implements \TYPO3\CMS\Core\SingletonInterface {
                                                        $modifiedAspectClassNamesWithUnderscores[$classNameWithUnderscores] = TRUE;
                                                }
                                                // As long as no modified aspect was found, we are optimistic that only part of the cache needs to be flushed:
-                                               if (count($modifiedAspectClassNamesWithUnderscores) === 0) {
+                                               if (empty($modifiedAspectClassNamesWithUnderscores)) {
                                                        $objectClassesCache->remove($classNameWithUnderscores);
                                                }
                                        }
                                }
                                $flushDoctrineProxyCache = FALSE;
-                               if (count($modifiedClassNamesWithUnderscores) > 0) {
+                               if (!empty($modifiedClassNamesWithUnderscores)) {
                                        $reflectionStatusCache = $this->getCache('FLOW3_Reflection_Status');
                                        foreach ($modifiedClassNamesWithUnderscores as $classNameWithUnderscores => $_) {
                                                $reflectionStatusCache->remove($classNameWithUnderscores);
@@ -266,7 +266,7 @@ class CacheManager implements \TYPO3\CMS\Core\SingletonInterface {
                                        }
                                        $objectConfigurationCache->remove('allCompiledCodeUpToDate');
                                }
-                               if (count($modifiedAspectClassNamesWithUnderscores) > 0) {
+                               if (!empty($modifiedAspectClassNamesWithUnderscores)) {
                                        $this->systemLogger->log('Aspect classes have been modified, flushing the whole proxy classes cache.', LOG_INFO);
                                        $objectClassesCache->flush();
                                }
index e52a46f..6af76cb 100644 (file)
@@ -132,7 +132,7 @@ class FlexFormTools {
                        foreach ($languages as $lInfo) {
                                $editData['meta']['currentLangId'][] = $lInfo['ISOcode'];
                        }
-                       if (!count($editData['meta']['currentLangId'])) {
+                       if (empty($editData['meta']['currentLangId'])) {
                                $editData['meta']['currentLangId'] = array('DEF');
                        }
                        $editData['meta']['currentLangId'] = array_unique($editData['meta']['currentLangId']);
@@ -351,19 +351,15 @@ class FlexFormTools {
                if (!is_array($pathArray)) {
                        $pathArray = explode('/', $pathArray);
                }
-               if (is_array($array)) {
-                       if (count($pathArray)) {
-                               $key = array_shift($pathArray);
-                               if (isset($array[$key])) {
-                                       if (!count($pathArray)) {
-                                               return $array[$key];
-                                       } else {
-                                               return $this->getArrayValueByPath($pathArray, $array[$key]);
-                                       }
-                               } else {
-                                       return NULL;
+               if (is_array($array) && !empty($pathArray)) {
+                       $key = array_shift($pathArray);
+                       if (isset($array[$key])) {
+                               if (empty($pathArray)) {
+                                       return $array[$key];
                                }
+                               return $this->getArrayValueByPath($pathArray, $array[$key]);
                        }
+                       return NULL;
                }
        }
 
@@ -380,19 +376,17 @@ class FlexFormTools {
                        if (!is_array($pathArray)) {
                                $pathArray = explode('/', $pathArray);
                        }
-                       if (is_array($array)) {
-                               if (count($pathArray)) {
-                                       $key = array_shift($pathArray);
-                                       if (!count($pathArray)) {
-                                               $array[$key] = $value;
-                                               return TRUE;
-                                       } else {
-                                               if (!isset($array[$key])) {
-                                                       $array[$key] = array();
-                                               }
-                                               return $this->setArrayValueByPath($pathArray, $array[$key], $value);
-                                       }
+                       if (is_array($array) && !empty($pathArray)) {
+                               $key = array_shift($pathArray);
+                               if (empty($pathArray)) {
+                                       $array[$key] = $value;
+                                       return TRUE;
                                }
+                               if (!isset($array[$key])) {
+                                       $array[$key] = array();
+                               }
+                               return $this->setArrayValueByPath($pathArray, $array[$key], $value);
+
                        }
                }
        }
index be401c9..2e35def 100644 (file)
@@ -84,7 +84,7 @@ abstract class AbstractConditionMatcher {
         * @return void
         */
        public function setRootline(array $rootline) {
-               if (count($rootline)) {
+               if (!empty($rootline)) {
                        $this->rootline = $rootline;
                }
        }
@@ -151,7 +151,7 @@ abstract class AbstractConditionMatcher {
                        return $this->simulateMatchResult;
                }
                // Return directly if matching for specific condition is simulated only:
-               if (count($this->simulateMatchConditions)) {
+               if (!empty($this->simulateMatchConditions)) {
                        return in_array($expression, $this->simulateMatchConditions);
                }
                // Sets the current pageId if not defined yet:
index 13476d7..bb31093 100644 (file)
@@ -80,7 +80,7 @@ class CommandLineController {
                }
                if ((string)$argv[0] === (string)$option) {
                        array_shift($argv);
-                       return count($argv) ? $argv : array('');
+                       return !empty($argv) ? $argv : array('');
                }
        }
 
@@ -166,7 +166,7 @@ class CommandLineController {
                                unset($cli_args_copy[$argSplit[0]]);
                        }
                }
-               if (count($cli_args_copy)) {
+               if (!empty($cli_args_copy)) {
                        echo wordwrap('ERROR: Option ' . implode(',', array_keys($cli_args_copy)) . ' was unknown to this script!' . LF . '(Options are: ' . implode(', ', $allOptions) . ')' . LF);
                        die;
                }
index 249e5fe..b31aaf1 100644 (file)
@@ -276,7 +276,7 @@ class Bootstrap {
                                $suitableRequestHandlers[$priority] = $requestHandler;
                        }
                }
-               if (count($suitableRequestHandlers) === 0) {
+               if (empty($suitableRequestHandlers)) {
                        throw new \TYPO3\CMS\Core\Exception('No suitable request handler found.', 1225418233);
                }
                ksort($suitableRequestHandlers);
index 79187e1..8a163a6 100644 (file)
@@ -1226,7 +1226,7 @@ class DataHandler {
                                        // Removing fields which are equal to the current value:
                                        $fieldArray = $this->compareFieldArrayWithCurrentAndUnset($table, $id, $fieldArray);
                                }
-                               if ($GLOBALS['TCA'][$table]['ctrl']['tstamp'] && count($fieldArray)) {
+                               if ($GLOBALS['TCA'][$table]['ctrl']['tstamp'] && !empty($fieldArray)) {
                                        $fieldArray[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
                                        if ($createNewVersion) {
                                                $newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
@@ -1288,7 +1288,7 @@ class DataHandler {
                                                        // only a certain number of fields needs to be checked for updates
                                                        // if $this->checkSimilar is TRUE, fields with unchanged values are already removed here
                                                        $fieldsToCheck = array_intersect($this->pagetreeRefreshFieldsFromPages, array_keys($fieldArray));
-                                                       if (count($fieldsToCheck)) {
+                                                       if (!empty($fieldsToCheck)) {
                                                                $this->pagetreeNeedsRefresh = TRUE;
                                                        }
                                                }
@@ -1342,7 +1342,7 @@ class DataHandler {
                                                $newRecord[$fieldName] = $justStoredRecord[$fieldName];
                                        }
                                }
-                               if (count($newRecord)) {
+                               if (!empty($newRecord)) {
                                        if ($this->enableLogging) {
                                                $this->newlog2('Shadowing done on fields <i>' . implode(',', array_keys($newRecord)) . '</i> in placeholder record ' . $table . ':' . $liveRec['uid'] . ' (offline version UID=' . $id . ')', $table, $liveRec['uid'], $liveRec['pid']);
                                        }
@@ -1981,7 +1981,7 @@ class DataHandler {
                                }
                        }
                        // During the check it turns out that the value / all values were removed - we respond by simply returning an empty array so nothing is written to DB for this field.
-                       if ($preCount && !count($valueArray)) {
+                       if ($preCount && empty($valueArray)) {
                                return array();
                        }
                }
@@ -2139,7 +2139,7 @@ class DataHandler {
                                        }
                                        $currentFilesForHistory = implode(',', $theFileValues);
                                        // DELETE files: If existing files were found, traverse those and register files for deletion which has been removed:
-                                       if (count($theFileValues)) {
+                                       if (!empty($theFileValues)) {
                                                // Traverse the input values and for all input values which match an EXISTING value, remove the existing from $theFileValues array (this will result in an array of all the existing files which should be deleted!)
                                                foreach ($valueArray as $key => $theFile) {
                                                        if ($theFile && !strstr(GeneralUtility::fixWindowsFilePath($theFile), '/')) {
@@ -2258,7 +2258,7 @@ class DataHandler {
                                $valueArray = $dbAnalysis->countItems();
                        }
                } else {
-                       if (count($valueArray)) {
+                       if (!empty($valueArray)) {
                                // If filehandling should NOT be bypassed, do processing:
                                if (!$this->bypassFileHandling) {
                                        // For logging..
@@ -3723,7 +3723,7 @@ class DataHandler {
                                        } elseif ($this->BE_USER->workspace > 0 && BackendUtility::isTableWorkspaceEnabled($v['table'])) {
                                                // A filled $workspaceOptions indicated that this call
                                                // has it's origin in previous versionizeRecord() processing
-                                               if (count($workspaceOptions)) {
+                                               if (!empty($workspaceOptions)) {
                                                        // Versions use live default id, thus the "new"
                                                        // id is the original live default child record
                                                        $newId = $v['id'];
@@ -4530,7 +4530,7 @@ class DataHandler {
                                                $value = implode(',', $dbAnalysisCurrent->getValueArray());
                                                $this->registerDBList[$table][$id][$field] = $value;
                                                // Remove child records (if synchronization requested it):
-                                               if (is_array($removeArray) && count($removeArray)) {
+                                               if (is_array($removeArray) && !empty($removeArray)) {
                                                        /** @var DataHandler $tce */
                                                        $tce = GeneralUtility::makeInstance(__CLASS__);
                                                        $tce->stripslashes_values = FALSE;
@@ -4549,7 +4549,7 @@ class DataHandler {
                                                        $updateFields = array($field => $dbAnalysisCurrent->countItems(FALSE));
                                                }
                                                // Update field referencing to child records of localized parent record:
-                                               if (is_array($updateFields) && count($updateFields)) {
+                                               if (is_array($updateFields) && !empty($updateFields)) {
                                                        $this->updateDB($table, $id, $updateFields);
                                                }
                                        }
@@ -5211,13 +5211,13 @@ class DataHandler {
                                        /** @var $dbAnalysis RelationHandler */
                                        $dbAnalysis = $this->createRelationHandlerInstance();
                                        $dbAnalysis->start('', $allowedTables, $conf['MM'], $id, $table, $conf);
-                                       if (count($dbAnalysis->getValueArray($prependName))) {
+                                       if (!empty($dbAnalysis->getValueArray($prependName))) {
                                                $this->version_remapMMForVersionSwap_reg[$id][$field] = array($dbAnalysis, $conf['MM'], $prependName);
                                        }
                                        /** @var $dbAnalysis RelationHandler */
                                        $dbAnalysis = $this->createRelationHandlerInstance();
                                        $dbAnalysis->start('', $allowedTables, $conf['MM'], $swapWith, $table, $conf);
-                                       if (count($dbAnalysis->getValueArray($prependName))) {
+                                       if (!empty($dbAnalysis->getValueArray($prependName))) {
                                                $this->version_remapMMForVersionSwap_reg[$swapWith][$field] = array($dbAnalysis, $conf['MM'], $prependName);
                                        }
                                }
@@ -5325,7 +5325,7 @@ class DataHandler {
         * @return void
         */
        public function remapListedDBRecords() {
-               if (count($this->registerDBList)) {
+               if (!empty($this->registerDBList)) {
                        foreach ($this->registerDBList as $table => $records) {
                                foreach ($records as $uid => $fields) {
                                        $newData = array();
@@ -5368,7 +5368,7 @@ class DataHandler {
                                                }
                                        }
                                        // If any fields were changed, those fields are updated!
-                                       if (count($newData)) {
+                                       if (!empty($newData)) {
                                                $this->updateDB($table, $theUidToUpdate_saveTo, $newData);
                                        }
                                }
@@ -5763,7 +5763,7 @@ class DataHandler {
                        }
                        // Clean up the $registerDBList array:
                        unset($registerDBList[$table][$id]);
-                       if (!count($registerDBList[$table])) {
+                       if (empty($registerDBList[$table])) {
                                unset($registerDBList[$table]);
                        }
                }
@@ -6263,7 +6263,7 @@ class DataHandler {
                if (is_array($fieldArray) && is_array($GLOBALS['TCA'][$table]) && (int)$id) {
                        // Do NOT update the UID field, ever!
                        unset($fieldArray['uid']);
-                       if (count($fieldArray)) {
+                       if (!empty($fieldArray)) {
                                $fieldArray = $this->insertUpdateDB_preprocessBasedOnFieldType($table, $fieldArray);
                                // Execute the UPDATE query:
                                $this->databaseConnection->exec_UPDATEquery($table, 'uid=' . (int)$id, $fieldArray);
@@ -6310,7 +6310,7 @@ class DataHandler {
                if (is_array($fieldArray) && is_array($GLOBALS['TCA'][$table]) && isset($fieldArray['pid'])) {
                        // Do NOT insert the UID field, ever!
                        unset($fieldArray['uid']);
-                       if (count($fieldArray)) {
+                       if (!empty($fieldArray)) {
                                // Check for "suggestedUid".
                                // This feature is used by the import functionality to force a new record to have a certain UID value.
                                // This is only recommended for use when the destination server is a passive mirror of another server.
@@ -7040,7 +7040,7 @@ class DataHandler {
                                        $newData[$field] = $prevData[$field];
                                }
                        }
-                       if ($update && count($newData)) {
+                       if ($update && !empty($newData)) {
                                $this->updateDB($table, $uid, $newData);
                        }
                }
@@ -7471,7 +7471,7 @@ class DataHandler {
                        $tagsToFlush[] = $cacheTag;
                }
                // process caching framwork operations
-               if (count($tagsToFlush) > 0) {
+               if (!empty($tagsToFlush)) {
                        foreach (array_unique($tagsToFlush) as $tag) {
                                $this->getCacheManager()->flushCachesInGroupByTag('pages', $tag);
                        }
index ef612a2..7db113f 100644 (file)
@@ -491,7 +491,7 @@ class DatabaseConnection {
        public function INSERTquery($table, $fields_values, $no_quote_fields = FALSE) {
                // Table and fieldnames should be "SQL-injection-safe" when supplied to this
                // function (contrary to values in the arrays which may be insecure).
-               if (!is_array($fields_values) || count($fields_values) === 0) {
+               if (!is_array($fields_values) || empty($fields_values)) {
                        return NULL;
                }
                foreach ($this->preProcessHookObjects as $hookObject) {
@@ -520,7 +520,7 @@ class DatabaseConnection {
        public function INSERTmultipleRows($table, array $fields, array $rows, $no_quote_fields = FALSE) {
                // Table and fieldnames should be "SQL-injection-safe" when supplied to this
                // function (contrary to values in the arrays which may be insecure).
-               if (count($rows) === 0) {
+               if (empty($rows)) {
                        return NULL;
                }
                foreach ($this->preProcessHookObjects as $hookObject) {
@@ -563,7 +563,7 @@ class DatabaseConnection {
                                $hookObject->UPDATEquery_preProcessAction($table, $where, $fields_values, $no_quote_fields, $this);
                        }
                        $fields = array();
-                       if (is_array($fields_values) && count($fields_values)) {
+                       if (is_array($fields_values) && !empty($fields_values)) {
                                // Quote and escape values
                                $nArr = $this->fullQuoteArray($fields_values, $table, $no_quote_fields, TRUE);
                                foreach ($nArr as $k => $v) {
@@ -1857,10 +1857,10 @@ class DatabaseConnection {
                                if ($error) {
                                        $data['error'] = $error;
                                }
-                               if (count($explain_output)) {
+                               if (!empty($explain_output)) {
                                        $data['explain'] = $explain_output;
                                }
-                               if (count($indices_output)) {
+                               if (!empty($indices_output)) {
                                        $data['indices'] = $indices_output;
                                }
                                if ($explainMode == 1) {
index ccb3220..7020350 100644 (file)
@@ -313,7 +313,7 @@ class PreparedStatement {
                        $precompiledQueryParts = $this->precompiledQueryParts;
 
                        $this->convertNamedPlaceholdersToQuestionMarks($query, $parameterValues, $precompiledQueryParts);
-                       if (count($precompiledQueryParts) > 0) {
+                       if (!empty($precompiledQueryParts)) {
                                $query = implode('', $precompiledQueryParts['queryParts']);
                        }
                        $this->statement = $GLOBALS['TYPO3_DB']->prepare_PREPAREDquery($query, $precompiledQueryParts);
@@ -369,7 +369,7 @@ class PreparedStatement {
                        return FALSE;
                }
 
-               if (count($this->fields) === 0) {
+               if (empty($this->fields)) {
                        // Store the list of fields
                        if ($this->statement instanceof \mysqli_stmt) {
                                $result = $this->statement->result_metadata();
@@ -594,7 +594,7 @@ class PreparedStatement {
                        if ($hasNamedPlaceholders) {
                                $query = $this->tokenizeQueryParameterMarkers($query, $parameterValues);
                        }
-               } elseif (count($parameterValues) > 0) {
+               } elseif (!empty($parameterValues)) {
                        $hasNamedPlaceholders = !is_int(key($parameterValues));
                        if ($hasNamedPlaceholders) {
                                for ($i = 1; $i < $queryPartsCount; $i += 2) {
index 0eddcf2..5296672 100644 (file)
@@ -391,7 +391,7 @@ class QueryView {
                                                $out .= GeneralUtility::callUserFunction($_funcRef, $GLOBALS['SOBE']->MOD_SETTINGS, $this);
                                        }
                                }
-                               if (count($rowArr)) {
+                               if (!empty($rowArr)) {
                                        $out .= '<table class="table table-striped table-hover">' . $this->resultRowTitles($lrow, $GLOBALS['TCA'][$table], $table) . implode(LF, $rowArr) . '</table>';
                                }
                                if (!$out) {
@@ -410,7 +410,7 @@ class QueryView {
                                        }
                                        $rowArr[] = $this->csvValues($row, ',', '"', $GLOBALS['TCA'][$table], $table);
                                }
-                               if (count($rowArr)) {
+                               if (!empty($rowArr)) {
                                        $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidth($this->formW) . ' class="text-monospace">' . GeneralUtility::formatForTextarea(implode(LF, $rowArr)) . '</textarea>';
                                        if (!$this->noDownloadB) {
                                                $out .= '<br><input class="btn btn-default" type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">';
index db54a24..f41ec0d 100644 (file)
@@ -655,7 +655,7 @@ class RelationHandler {
                                }
                        }
                        // Delete all not-used relations:
-                       if (is_array($oldMMs) && count($oldMMs) > 0) {
+                       if (is_array($oldMMs) && !empty($oldMMs)) {
                                $removeClauses = array();
                                $updateRefIndex_records = array();
                                foreach ($oldMMs as $oldMM_key => $mmItem) {
@@ -807,7 +807,7 @@ class RelationHandler {
                $sortby = $GLOBALS['TYPO3_DB']->stripOrderBy($sortby);
                // Get the rows from storage
                $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $foreign_table, $whereClause, '', $sortby, '', 'uid');
-               if (count($rows)) {
+               if (!empty($rows)) {
                        if (BackendUtility::isTableWorkspaceEnabled($foreign_table) && !$this->useLiveReferenceIds) {
                                $rows = $this->getRecordVersionsIds($foreign_table, $rows);
                        }
@@ -844,7 +844,7 @@ class RelationHandler {
                $foreign_table_field = $conf['foreign_table_field'];
                $foreign_match_fields = is_array($conf['foreign_match_fields']) ? $conf['foreign_match_fields'] : array();
                // If there are table items and we have a proper $parentUid
-               if (MathUtility::canBeInterpretedAsInteger($parentUid) && count($this->tableArray)) {
+               if (MathUtility::canBeInterpretedAsInteger($parentUid) && !empty($this->tableArray)) {
                        // If updateToUid is not a positive integer, set it to '0', so it will be ignored
                        if (!(MathUtility::canBeInterpretedAsInteger($updateToUid) && $updateToUid > 0)) {
                                $updateToUid = 0;
@@ -916,7 +916,7 @@ class RelationHandler {
                                        }
                                }
                                // Update accordant fields in the database:
-                               if (count($updateValues)) {
+                               if (!empty($updateValues)) {
                                        $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . (int)$uid, $updateValues);
                                        $this->updateRefIndex($table, $uid);
                                }
@@ -1127,7 +1127,7 @@ class RelationHandler {
                $itemArrayHasBeenPurged = FALSE;
 
                foreach ($this->tableArray as $itemTableName => $itemIds) {
-                       if (!count($itemIds) || !BackendUtility::isTableWorkspaceEnabled($itemTableName)) {
+                       if (empty($itemIds) || !BackendUtility::isTableWorkspaceEnabled($itemTableName)) {
                                continue;
                        }
 
@@ -1137,7 +1137,7 @@ class RelationHandler {
                                $this->removeFromItemArray($itemTableName, $removedItemId);
                        }
                        $this->tableArray[$itemTableName] = $purgedItemIds;
-                       if (count($removedItemIds)) {
+                       if (!empty($removedItemIds)) {
                                $itemArrayHasBeenPurged = TRUE;
                        }
                }
index add802f..e89fbb8 100644 (file)
@@ -216,7 +216,7 @@ class SoftReferenceIndex {
                        }
                }
                // Return result:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => implode('', $splitContent),
                                'elements' => $elements
@@ -251,7 +251,7 @@ class SoftReferenceIndex {
                        $linkElement[$k] = $this->setTypoLinkPartsElement($tLP, $elements, $typolinkValue, $k);
                }
                // Return output:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => implode(',', $linkElement),
                                'elements' => $elements
@@ -283,7 +283,7 @@ class SoftReferenceIndex {
                        }
                }
                // Return output:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => implode('', $linkTags),
                                'elements' => $elements
@@ -356,7 +356,7 @@ class SoftReferenceIndex {
                // Process free fileadmin/ references as well:
                $content = $this->fileadminReferences($content, $elements);
                // Return output:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => $content,
                                'elements' => $elements
@@ -378,7 +378,7 @@ class SoftReferenceIndex {
                // Process free fileadmin/ references from TSconfig
                $content = $this->fileadminReferences($content, $elements);
                // Return output:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => $content,
                                'elements' => $elements
@@ -414,7 +414,7 @@ class SoftReferenceIndex {
                        }
                }
                // Return output:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => substr(implode('', $parts), 1, -1),
                                'elements' => $elements
@@ -453,7 +453,7 @@ class SoftReferenceIndex {
                        }
                }
                // Return output:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => substr(implode('', $parts), 1, -1),
                                'elements' => $elements
@@ -481,7 +481,7 @@ class SoftReferenceIndex {
                        }
                }
                // Return output:
-               if (count($elements)) {
+               if (!empty($elements)) {
                        $resultArray = array(
                                'content' => substr(implode('', $parts), 1, -1),
                                'elements' => $elements
index f9eca52..3ef36b2 100644 (file)
@@ -1585,7 +1585,7 @@ class SqlParser {
                }
                // Make query:
                $query = 'INSERT INTO ' . $components['TABLE'];
-               if (count($tableFields)) {
+               if (!empty($tableFields)) {
                        $query .= ' (' . implode(',', $tableFields) . ')';
                }
                $query .= ' VALUES ' . implode(',', $values);
index c3bce42..dfd684f 100644 (file)
@@ -141,7 +141,7 @@ Uncaught TYPO3 Exception ' . $exceptionCodeNumber . $exception->getMessage() . L
         */
        protected function getBacktraceCode(array $trace) {
                $backtraceCode = '';
-               if (count($trace)) {
+               if (!empty($trace)) {
                        foreach ($trace as $index => $step) {
                                $class = isset($step['class']) ? $step['class'] . '<span style="color:white;">::</span>' : '';
                                $arguments = '';
index c719822..bba714c 100644 (file)
@@ -66,7 +66,7 @@ class ExtDirectApi {
        public function getApiPhp(array $filterNamespaces) {
                $javascriptNamespaces = $this->getExtDirectApi($filterNamespaces);
                // Return the generated javascript API configuration
-               if (count($javascriptNamespaces)) {
+               if (!empty($javascriptNamespaces)) {
                        return '
                                if (!Ext.isObject(Ext.app.ExtDirectAPI)) {
                                        Ext.app.ExtDirectAPI = {};
@@ -159,7 +159,7 @@ class ExtDirectApi {
                // Generate the javascript content if it wasn't found inside the cache and cache it!
                if ($noCache || !is_array(($javascriptNamespaces = \TYPO3\CMS\Frontend\Page\PageRepository::getHash($cacheHash)))) {
                        $javascriptNamespaces = $this->generateAPI($filterNamespaces);
-                       if (count($javascriptNamespaces)) {
+                       if (!empty($javascriptNamespaces)) {
                                \TYPO3\CMS\Frontend\Page\PageRepository::storeHash($cacheHash, $javascriptNamespaces, $cacheIdentifier);
                        }
                }
@@ -173,7 +173,7 @@ class ExtDirectApi {
         * @return string $errorMessage
         */
        protected function getNamespaceError(array $filterNamespaces) {
-               if (count($filterNamespaces)) {
+               if (!empty($filterNamespaces)) {
                        // Namespace error
                        $errorMessage = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ExtDirect.namespaceError'), __CLASS__, implode(',', $filterNamespaces));
                } else {
index 2031161..efdca08 100644 (file)
@@ -57,7 +57,7 @@ class ExtDirectDebug {
         */
        public function toString() {
                $messagesAsString = '';
-               if (count($this->debugMessages)) {
+               if (!empty($this->debugMessages)) {
                        $messagesAsString = \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->debugMessages);
                }
                return $messagesAsString;
index fcf3af6..958fe36 100644 (file)
@@ -363,7 +363,7 @@ class FrontendEditingController {
         */
        public function doDelete($table, $uid) {
                $cmdData[$table][$uid]['delete'] = 1;
-               if (count($cmdData)) {
+               if (!empty($cmdData)) {
                        $this->initializeTceMain();
                        $this->tce->start(array(), $cmdData);
                        $this->tce->process_cmdmap();
@@ -480,11 +480,11 @@ class FrontendEditingController {
                                if ($table == 'pages') {
                                        $allow = $this->getAllowedEditActions($table, $conf, $dataArray['pid'], $allow);
                                        // Can only display editbox if there are options in the menu
-                                       if (count($allow)) {
+                                       if (!empty($allow)) {
                                                $mayEdit = TRUE;
                                        }
                                } else {
-                                       $mayEdit = count($allow) && $perms & Permission::CONTENT_EDIT;
+                                       $mayEdit = !empty($allow) && $perms & Permission::CONTENT_EDIT;
                                }
                        }
                }
index 7019bfe..7512afd 100644 (file)
@@ -200,7 +200,7 @@ class HtmlParser {
                                        // use strtr instead of strtoupper to avoid locale problems with Turkish
                                        $marker = strtr($marker, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
                                }
-                               if (count($wrapArr) > 0) {
+                               if (!empty($wrapArr)) {
                                        $marker = $wrapArr[0] . $marker . $wrapArr[1];
                                }
                                $search[] = $marker;
@@ -273,7 +273,7 @@ class HtmlParser {
                                // Use strtr instead of strtoupper to avoid locale problems with Turkish
                                $subpartMarker = strtr($subpartMarker, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
                        }
-                       if (count($wraps) > 0) {
+                       if (!empty($wraps)) {
                                $subpartMarker = $wraps[0] . $subpartMarker . $wraps[1];
                        }
                        $subTemplates[$subpartMarker] = self::getSubpart($content, $subpartMarker);
@@ -285,10 +285,10 @@ class HtmlParser {
                                // use strtr instead of strtoupper to avoid locale problems with Turkish
                                $completeMarker = strtr($completeMarker, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
                        }
-                       if (count($wraps) > 0) {
+                       if (!empty($wraps)) {
                                $completeMarker = $wraps[0] . $completeMarker . $wraps[1];
                        }
-                       if (count($markersAndSubparts[$subpartMarker]) > 0) {
+                       if (!empty($markersAndSubparts[$subpartMarker])) {
                                foreach ($markersAndSubparts[$subpartMarker] as $partialMarkersAndSubparts) {
                                        $subpartSubstitutes[$completeMarker] .= self::substituteMarkerAndSubpartArrayRecursive($subTemplates[$completeMarker],
                                                $partialMarkersAndSubparts, $wrap, $uppercase, $deleteUnused);
@@ -843,7 +843,7 @@ class HtmlParser {
                                                                                                                        $newClasses[] = $class;
                                                                                                                }
                                                                                                        }
-                                                                                                       if (count($newClasses)) {
+                                                                                                       if (!empty($newClasses)) {
                                                                                                                $tagAttrib[0][$attr] = implode(' ', $newClasses);
                                                                                                        } else {
                                                                                                                $tagAttrib[0][$attr] = '';
@@ -924,7 +924,7 @@ class HtmlParser {
                                                                                        $lastEl = end($tagStack);
                                                                                        if ($tagName !== $lastEl) {
                                                                                                if (in_array($tagName, $tagStack)) {
-                                                                                                       while (count($tagStack) && $tagName !== $lastEl) {
+                                                                                                       while (!empty($tagStack) && $tagName !== $lastEl) {
                                                                                                                $elPos = end($tagRegister[$lastEl]);
                                                                                                                unset($newContent[$elPos]);
                                                                                                                array_pop($tagRegister[$lastEl]);
@@ -937,7 +937,7 @@ class HtmlParser {
                                                                                                }
                                                                                        }
                                                                                }
-                                                                               if (!count($tagRegister[$tagName]) || !$correctTag) {
+                                                                               if (empty($tagRegister[$tagName]) || !$correctTag) {
                                                                                        $setTag = 0;
                                                                                } else {
                                                                                        array_pop($tagRegister[$tagName]);
@@ -1155,7 +1155,7 @@ class HtmlParser {
                                        $newAttribs[] = 'color="' . $attribArray['color'] . '"';
                                }
                                $innerContent = $this->cleanFontTags($this->removeFirstAndLastTag($v), $keepFace, $keepSize, $keepColor);
-                               if (count($newAttribs)) {
+                               if (!empty($newAttribs)) {
                                        $fontSplit[$k] = '<font ' . implode(' ', $newAttribs) . '>' . $innerContent . '</font>';
                                } else {
                                        $fontSplit[$k] = $innerContent;
@@ -1475,7 +1475,7 @@ class HtmlParser {
         */
        public function processTag($value, $conf, $endTag, $protected = 0) {
                // Return immediately if protected or no parameters
-               if ($protected || !count($conf)) {
+               if ($protected || empty($conf)) {
                        return $value;
                }
                // OK then, begin processing for XHTML output:
index 5f04dff..5bff145 100644 (file)
@@ -1322,7 +1322,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
                                                $attribs = $this->get_tag_attributes($fTag);
                                                // Keep attributes (lowercase)
                                                $newAttribs = array();
-                                               if (count($keepAttribListArr)) {
+                                               if (!empty($keepAttribListArr)) {
                                                        foreach ($keepAttribListArr as $keepA) {
                                                                if (isset($attribs[0][$keepA])) {
                                                                        $newAttribs[$keepA] = $attribs[0][$keepA];
@@ -1337,7 +1337,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
                                                // CLASS attribute:
                                                // Set to whatever value
                                                if (!$this->procOptions['skipClass'] && trim($attribs[0]['class']) !== '') {
-                                                       if (!count($this->allowedClasses) || in_array($attribs[0]['class'], $this->allowedClasses)) {
+                                                       if (empty($this->allowedClasses) || in_array($attribs[0]['class'], $this->allowedClasses)) {
                                                                $newAttribs['class'] = $attribs[0]['class'];
                                                        } else {
                                                                $classes = GeneralUtility::trimExplode(' ', $attribs[0]['class'], TRUE);
@@ -1347,7 +1347,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
                                                                                $newClasses[] = $class;
                                                                        }
                                                                }
-                                                               if (count($newClasses)) {
+                                                               if (!empty($newClasses)) {
                                                                        $newAttribs['class'] = implode(' ', $newClasses);
                                                                }
                                                        }
@@ -1355,7 +1355,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
                                                // Remove any line break char (10 or 13)
                                                $subLines[$sk] = preg_replace('/' . LF . '|' . CR . '/', '', $subLines[$sk]);
                                                // If there are any attributes or if we are supposed to remap the tag, then do so:
-                                               if (count($newAttribs) && $remapParagraphTag !== '1') {
+                                               if (!empty($newAttribs) && $remapParagraphTag !== '1') {
                                                        if ($remapParagraphTag === 'P') {
                                                                $tagName = 'p';
                                                        }
index 2a427bc..1be1e54 100644 (file)
@@ -980,7 +980,7 @@ class GraphicalFunctions {
                                        $calc = ImageTTFBBox(GeneralUtility::freetypeDpiComp($sF * $strCfg['fontSize']), $angle, $fontFile, $strCfg['str']);
                                } while ($calc[2] < 0 && $try++ < 10);
                                // Calculate offsets:
-                               if (!count($offsetInfo)) {
+                               if (empty($offsetInfo)) {
                                        // First run, just copy over.
                                        $offsetInfo = $calc;
                                } else {
@@ -1097,7 +1097,7 @@ class GraphicalFunctions {
                                                                }
                                                        }
                                                        // Set the new result as result array:
-                                                       if (count($newResult)) {
+                                                       if (!empty($newResult)) {
                                                                $result = $newResult;
                                                        }
                                                }
@@ -1171,7 +1171,7 @@ class GraphicalFunctions {
                                                                }
                                                        }
                                                        // Set the new result as result array:
-                                                       if (count($newResult)) {
+                                                       if (!empty($newResult)) {
                                                                $result = $newResult;
                                                        }
                                                }
@@ -2935,7 +2935,7 @@ class GraphicalFunctions {
         */
        public function unifyColors(&$img, $colArr, $closest = FALSE) {
                $retCol = -1;
-               if (is_array($colArr) && count($colArr) && function_exists('imagepng') && function_exists('imagecreatefrompng')) {
+               if (is_array($colArr) && !empty($colArr) && function_exists('imagepng') && function_exists('imagecreatefrompng')) {
                        $firstCol = array_shift($colArr);
                        $firstColArr = $this->convertColor($firstCol);
                        if (count($colArr) > 1) {
index 4f7b6fa..2233c19 100644 (file)
@@ -426,7 +426,7 @@ class Rfc822AddressesParser {
                // Check that $addresses is set, if address like this:
                // Groupname:;
                // Then errors were appearing.
-               if (!count($addresses)) {
+               if (empty($addresses)) {
                        $this->error = 'Empty group.';
                        return FALSE;
                }
@@ -465,7 +465,7 @@ class Rfc822AddressesParser {
                // Splits on one or more Tab or space.
                $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY);
                $phrase_parts = array();
-               while (count($parts) > 0) {
+               while (!empty($parts)) {
                        $phrase_parts[] = $this->_splitCheck($parts, ' ');
                        for ($i = 0; $i < $this->index + 1; $i++) {
                                array_shift($parts);
@@ -687,7 +687,7 @@ class Rfc822AddressesParser {
        protected function _validateDomain($domain) {
                // Note the different use of $subdomains and $sub_domains
                $subdomains = explode('.', $domain);
-               while (count($subdomains) > 0) {
+               while (!empty($subdomains)) {
                        $sub_domains[] = $this->_splitCheck($subdomains, '.');
                        for ($i = 0; $i < $this->index + 1; $i++) {
                                array_shift($subdomains);
@@ -778,7 +778,7 @@ class Rfc822AddressesParser {
                $parts = explode('.', $local_part);
                $words = array();
                // Split the local_part into words.
-               while (count($parts) > 0) {
+               while (!empty($parts)) {
                        $words[] = $this->_splitCheck($parts, '.');
                        for ($i = 0; $i < $this->index + 1; $i++) {
                                array_shift($parts);
index 9c7b7a2..95060bd 100644 (file)
@@ -1355,7 +1355,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                        return;
                }
                $this->extDirectCodeAdded = TRUE;
-               if (count($filterNamespaces) === 0) {
+               if (empty($filterNamespaces)) {
                        $filterNamespaces = array('TYPO3');
                }
                // @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
@@ -1594,7 +1594,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
        public function loadRequireJs() {
 
                // load all paths to map to package names / namespaces
-               if (count($this->requireJsConfig) === 0) {
+               if (empty($this->requireJsConfig)) {
                        // first, load all paths for the namespaces, and configure contrib libs.
                        $this->requireJsConfig['paths'] = array(
                                'jquery-ui' => $this->backPath . 'sysext/core/Resources/Public/JavaScript/Contrib/jquery-ui',
@@ -2161,7 +2161,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                        if (in_array('dragdrop', $mods) || in_array('controls', $mods)) {
                                $mods = array_merge(array('effects'), $mods);
                        }
-                       if (count($mods)) {
+                       if (!empty($mods)) {
                                foreach ($mods as $module) {
                                        $out .= '<script src="' . $this->processJsFile(($this->backPath . $this->scriptaculousPath . $module . '.js')) . '" type="text/javascript"></script>' . LF;
                                        unset($this->jsFiles[$this->backPath . $this->scriptaculousPath . $module . '.js']);
@@ -2209,7 +2209,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                if ($this->addExtCore || $this->addExtJS) {
                        // Set clear.gif, move it on top, add handler code
                        $code = '';
-                       if (count($this->extOnReadyCode)) {
+                       if (!empty($this->extOnReadyCode)) {
                                foreach ($this->extOnReadyCode as $block) {
                                        $code .= $block;
                                }
@@ -2261,7 +2261,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
         * Load the language strings into JavaScript
         */
        protected function loadJavaScriptLanguageStrings() {
-               if (count($this->inlineLanguageLabelFiles)) {
+               if (!empty($this->inlineLanguageLabelFiles)) {
                        foreach ($this->inlineLanguageLabelFiles as $languageLabelFile) {
                                $this->includeLanguageFileForInline($languageLabelFile['fileRef'], $languageLabelFile['selectionPrefix'], $languageLabelFile['stripFromSelectionName'], $languageLabelFile['errorMode']);
                        }
@@ -2342,7 +2342,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function renderCssLibraries() {
                $cssFiles = '';
-               if (count($this->cssLibs)) {
+               if (!empty($this->cssLibs)) {
                        foreach ($this->cssLibs as $file => $properties) {
                                $file = GeneralUtility::resolveBackPath($file);
                                $file = GeneralUtility::createVersionNumberedFilename($file);
@@ -2373,7 +2373,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function renderCssFiles() {
                $cssFiles = '';
-               if (count($this->cssFiles)) {
+               if (!empty($this->cssFiles)) {
                        foreach ($this->cssFiles as $file => $properties) {
                                $file = GeneralUtility::resolveBackPath($file);
                                $file = GeneralUtility::createVersionNumberedFilename($file);
@@ -2404,7 +2404,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function renderCssInline() {
                $cssInline = '';
-               if (count($this->cssInline)) {
+               if (!empty($this->cssInline)) {
                        foreach ($this->cssInline as $name => $properties) {
                                $cssCode = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
                                if ($properties['forceOnTop']) {
@@ -2426,7 +2426,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
        protected function renderAdditionalJavaScriptLibraries() {
                $jsLibs = '';
                $jsFooterLibs = '';
-               if (count($this->jsLibs)) {
+               if (!empty($this->jsLibs)) {
                        foreach ($this->jsLibs as $properties) {
                                $properties['file'] = GeneralUtility::resolveBackPath($properties['file']);
                                $properties['file'] = GeneralUtility::createVersionNumberedFilename($properties['file']);
@@ -2468,7 +2468,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
        protected function renderJavaScriptFiles() {
                $jsFiles = '';
                $jsFooterFiles = '';
-               if (count($this->jsFiles)) {
+               if (!empty($this->jsFiles)) {
                        foreach ($this->jsFiles as $file => $properties) {
                                $file = GeneralUtility::resolveBackPath($file);
                                $file = GeneralUtility::createVersionNumberedFilename($file);
@@ -2510,7 +2510,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
        protected function renderInlineJavaScript() {
                $jsInline = '';
                $jsFooterInline = '';
-               if (count($this->jsInline)) {
+               if (!empty($this->jsInline)) {
                        foreach ($this->jsInline as $name => $properties) {
                                $jsCode = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
                                if ($properties['forceOnTop']) {
@@ -2735,7 +2735,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                                GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler'], $params, $this);
                        } else {
                                // Traverse the arrays, compress files
-                               if (count($this->jsInline)) {
+                               if (!empty($this->jsInline)) {
                                        foreach ($this->jsInline as $name => $properties) {
                                                if ($properties['compress']) {
                                                        $error = '';
index 56b2ea6..725adcd 100644 (file)
@@ -622,7 +622,7 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
         * @return array
         */
        protected function extractFileInformation($filePath, $containerPath, array $propertiesToExtract = array()) {
-               if (count($propertiesToExtract) === 0) {
+               if (empty($propertiesToExtract)) {
                        $propertiesToExtract = array(
                                'size', 'atime', 'atime', 'mtime', 'ctime', 'mimetype', 'name',
                                'identifier', 'identifier_hash', 'storage', 'folder_hash'
index 181e5f3..395ba85 100644 (file)
@@ -109,11 +109,11 @@ class FileExtensionFilter {
                $result = TRUE;
                $fileExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
                // Check allowed file extensions
-               if ($this->allowedFileExtensions !== NULL && count($this->allowedFileExtensions) > 0 && !in_array($fileExt, $this->allowedFileExtensions)) {
+               if ($this->allowedFileExtensions !== NULL && !empty($this->allowedFileExtensions) && !in_array($fileExt, $this->allowedFileExtensions)) {
                        $result = FALSE;
                }
                // Check disallowed file extensions
-               if ($this->disallowedFileExtensions !== NULL && count($this->disallowedFileExtensions) > 0 && in_array($fileExt, $this->disallowedFileExtensions)) {
+               if ($this->disallowedFileExtensions !== NULL && !empty($this->disallowedFileExtensions) && in_array($fileExt, $this->disallowedFileExtensions)) {
                        $result = FALSE;
                }
                return $result;
index 6bb4bd2..fe24a46 100644 (file)
@@ -413,7 +413,7 @@ class Folder implements FolderInterface {
                                break;
 
                        case self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS:
-                               if (count($this->fileAndFolderNameFilters) > 0) {
+                               if (!empty($this->fileAndFolderNameFilters)) {
                                        $backedUpFilters = $this->storage->getFileAndFolderNameFilters();
                                        foreach ($this->fileAndFolderNameFilters as $filter) {
                                                $this->storage->addFileAndFolderNameFilter($filter);
index 8d3e8f6..c9774b8 100644 (file)
@@ -95,7 +95,7 @@ class ExtractorRegistry implements SingletonInterface {
 
                $filteredExtractors = array();
                foreach ($allExtractors as $priority => $extractorObject) {
-                       if (count($extractorObject->getDriverRestrictions()) == 0) {
+                       if (empty($extractorObject->getDriverRestrictions())) {
                                $filteredExtractors[$priority] = $extractorObject;
                        } elseif (in_array($driverType, $extractorObject->getDriverRestrictions())) {
                                $filteredExtractors[$priority] = $extractorObject;
index c42c766..a1f5e69 100644 (file)
@@ -249,7 +249,7 @@ class FileIndexRepository implements SingletonInterface {
                foreach ($updatedProperties as $key) {
                        $updateRow[$key] = $file->getProperty($key);
                }
-               if (count($updateRow) > 0) {
+               if (!empty($updateRow)) {
                        $updateRow['tstamp'] = time();
                        $this->getDatabaseConnection()->exec_UPDATEquery($this->table, $this->getWhereClauseForFile($file), $updateRow);
                        $this->updateRefIndex($file->getUid());
index 1d39cfc..a382ac2 100644 (file)
@@ -149,7 +149,7 @@ class MetaDataRepository implements SingletonInterface {
         * @internal
         */
        public function update($fileUid, array $data) {
-               if (count($this->tableFields) === 0) {
+               if (empty($this->tableFields)) {
                        $this->tableFields = $this->getDatabaseConnection()->admin_get_fields($this->tableName);
                }
                $updateRow = array_intersect_key($data, $this->tableFields);
@@ -157,7 +157,7 @@ class MetaDataRepository implements SingletonInterface {
                        unset($updateRow['uid']);
                }
                $row = $this->findByFileUid($fileUid);
-               if (count($updateRow) > 0) {
+               if (!empty($updateRow)) {
                        $updateRow['tstamp'] = time();
                        $this->getDatabaseConnection()->exec_UPDATEquery($this->tableName, 'uid = ' . (int)$row['uid'], $updateRow);
 
index 37aedf3..dedce6b 100644 (file)
@@ -268,7 +268,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
                }
                if (!$this->collectionInstances[$uid]) {
                        // Get mount data if not already supplied as argument to this function
-                       if (count($recordData) === 0 || $recordData['uid'] !== $uid) {
+                       if (empty($recordData) || $recordData['uid'] !== $uid) {
                                /** @var $GLOBALS['TYPO3_DB'] \TYPO3\CMS\Core\Database\DatabaseConnection */
                                $recordData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file_collection', 'uid=' . (int)$uid . ' AND deleted=0');
                                if (!is_array($recordData)) {
index f7c1012..28b9fa2 100644 (file)
@@ -2201,7 +2201,7 @@ class ResourceStorage implements ResourceStorageInterface {
         * @return Folder
         */
        public function getRootLevelFolder($respectFileMounts = TRUE) {
-               if ($respectFileMounts && count($this->fileMounts)) {
+               if ($respectFileMounts && !empty($this->fileMounts)) {
                        $mount = reset($this->fileMounts);
                        return $mount['folder'];
                } else {
index 84ca794..999e73a 100644 (file)
@@ -34,7 +34,7 @@ class UserFileInlineLabelService {
                        ? $params['options']['sys_file']
                        : array();
 
-               if (!count($sysFileFields)) {
+               if (empty($sysFileFields)) {
                        // Nothing to do
                        $params['title'] = $params['row']['uid'];
                        return;
index 2d9f3a7..d58c1c7 100644 (file)
@@ -54,7 +54,7 @@ class UserFileMountService {
                                $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
                                $queue = $flashMessageService->getMessageQueueByIdentifier();
                                $queue->enqueue(new FlashMessage('Storage #' . $storageUid . ' does not exist. No folder is currently selectable.', '', FlashMessage::ERROR));
-                               if (!count($PA['items'])) {
+                               if (empty($PA['items'])) {
                                        $PA['items'][] = array(
                                                $PA['row'][$PA['field']],
                                                $PA['row'][$PA['field']]
@@ -86,7 +86,7 @@ class UserFileMountService {
                                $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
                                $queue = $flashMessageService->getMessageQueueByIdentifier();
                                $queue->enqueue(new FlashMessage('Storage "' . $storage->getName() . '" is not browsable. No folder is currently selectable.', '', FlashMessage::WARNING));
-                               if (!count($PA['items'])) {
+                               if (empty($PA['items'])) {
                                        $PA['items'][] = array(
                                                $PA['row'][$PA['field']],
                                                $PA['row'][$PA['field']]
index 8e5b9cc..c3e5903 100644 (file)
@@ -183,7 +183,7 @@ abstract class AbstractService {
        public function getLastError() {
                // Means all is ok - no error
                $lastError = TRUE;
-               if (count($this->error)) {
+               if (!empty($this->error)) {
                        $error = end($this->error);
                        $lastError = $error['nr'];
                }
@@ -197,7 +197,7 @@ abstract class AbstractService {
         */
        public function getLastErrorMsg() {
                $lastErrorMessage = '';
-               if (count($this->error)) {
+               if (!empty($this->error)) {
                        $error = end($this->error);
                        $lastErrorMessage = $error['msg'];
                }
@@ -211,7 +211,7 @@ abstract class AbstractService {
         */
        public function getErrorMsgArray() {
                $errArr = array();
-               if (count($this->error)) {
+               if (!empty($this->error)) {
                        foreach ($this->error as $error) {
                                $errArr[] = $error['msg'];
                        }
index f516930..0916324 100644 (file)
@@ -333,7 +333,7 @@ class TimeTracker {
                                array_pop($temp);
                                $temp = array_reverse($temp);
                                array_pop($temp);
-                               if (count($temp)) {
+                               if (!empty($temp)) {
                                        $keyLabel = '<br /><span style="color:#999999;">' . implode($temp, '<br />') . '</span>';
                                }
                        }
@@ -380,7 +380,7 @@ class TimeTracker {
                                }
                                $msgArr[] = '<span style="color:#000066;">' . nl2br($data['content']) . '</span>';
                        }
-                       if (count($msgArr)) {
+                       if (!empty($msgArr)) {
                                $msg = implode($msgArr, '<hr />');
                        }
                        $item .= '<td valign="top" class="' . $logRowClass . '" style="text-align:left;">' . $this->fw($msg) . '</td>';
index a192e90..44cda3b 100644 (file)
@@ -317,7 +317,7 @@ class DatabaseTreeDataProvider extends AbstractTableConfigurationTreeDataProvide
                }
                $storage = NULL;
                $children = $this->getRelatedRecords($nodeData);
-               if (count($children)) {
+               if (!empty($children)) {
                        /** @var $storage \TYPO3\CMS\Backend\Tree\TreeNodeCollection */
                        $storage = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\TreeNodeCollection::class);
                        foreach ($children as $child) {
index 52887cc..9825f97 100644 (file)
@@ -988,7 +988,7 @@ class ExtendedTemplateService extends TemplateService {
                // Returns array used for labels in the menu.
                $retArr = array();
                foreach ($this->categories as $k => $v) {
-                       if (count($v)) {
+                       if (!empty($v)) {
                                $retArr[$k] = strtoupper($k) . ' (' . count($v) . ')';
                        }
                }
index a30bea5..9d83d42 100644 (file)
@@ -544,7 +544,7 @@ class TypoScriptParser {
                        case 'removeFromList':
                                $existingElements = GeneralUtility::trimExplode(',', $currentValue);
                                $removeElements = GeneralUtility::trimExplode(',', $modifierArgument);
-                               if (count($removeElements)) {
+                               if (!empty($removeElements)) {
                                        $newValue = implode(',', array_diff($existingElements, $removeElements));
                                }
                                break;
index 2f0d173..9dda009 100644 (file)
@@ -729,7 +729,7 @@ class TemplateService {
         * @throws \RuntimeException If the given $fullRootLine does not contain all pages that are in the current template rootline
         */
        public function updateRootlineData($fullRootLine) {
-               if (!is_array($this->rootLine) || count($this->rootLine) === 0) {
+               if (!is_array($this->rootLine) || empty($this->rootLine)) {
                        return;
                }
 
@@ -1546,7 +1546,7 @@ class TemplateService {
                }
                // Finding MP var for Page ID:
                if ($pageId) {
-                       if (is_array($this->MPmap[$pageId]) && count($this->MPmap[$pageId])) {
+                       if (is_array($this->MPmap[$pageId]) && !empty($this->MPmap[$pageId])) {
                                return implode(',', $this->MPmap[$pageId]);
                        }
                }
index 1ac0399..d4c46f2 100644 (file)
@@ -64,7 +64,7 @@ class ArrayUtility {
                                ($resultArray[$key] = $value);
                        } elseif (is_array($value)) {
                                ($subArrayMatches = static::filterByValueRecursive($needle, $value));
-                               if (count($subArrayMatches) > 0) {
+                               if (!empty($subArrayMatches)) {
                                        ($resultArray[$key] = $subArrayMatches);
                                }
                        }
@@ -317,7 +317,7 @@ class ArrayUtility {
                                $lines .= is_int($key) ? $key . ' => ' : '\'' . $key . '\' => ';
                        }
                        if (is_array($value)) {
-                               if (count($value) > 0) {
+                               if (!empty($value)) {
                                        $lines .= self::arrayExport($value, $level);
                                } else {
                                        $lines .= 'array(),' . LF;
@@ -614,7 +614,7 @@ class ArrayUtility {
                                $getValueFunc = NULL;
                        }
                        // Do the filtering:
-                       if (is_array($keepItems) && count($keepItems)) {
+                       if (is_array($keepItems) && !empty($keepItems)) {
                                foreach ($array as $key => $value) {
                                        // Get the value to compare by using the callback function:
                                        $keepValue = isset($getValueFunc) ? call_user_func($getValueFunc, $value) : $value;
index 9b8cc33..593896d 100644 (file)
@@ -41,7 +41,7 @@ class ClientUtility {
                                // so create a reference to NULL
                                $null = NULL;
                                $hookResult = GeneralUtility::callUserFunction($hookFunction, $hookParameters, $null);
-                               if ($returnResult && is_array($hookResult) && count($hookResult)) {
+                               if ($returnResult && is_array($hookResult) && !empty($hookResult)) {
                                        return $hookResult;
                                }
                        }
index bf217e6..c502e2e 100644 (file)
@@ -135,10 +135,11 @@ class CommandUtility {
                if ($command == 'composite' && $switchCompositeParameters) {
                        $paramsArr = GeneralUtility::unQuoteFilenames($parameters);
                        // The mask image has been specified => swap the parameters
-                       if (count($paramsArr) > 5) {
-                               $tmp = $paramsArr[count($paramsArr) - 3];
-                               $paramsArr[count($paramsArr) - 3] = $paramsArr[count($paramsArr) - 4];
-                               $paramsArr[count($paramsArr) - 4] = $tmp;
+                       $paramsArrCount = count($paramsArr);
+                       if ($paramsArrCount > 5) {
+                               $tmp = $paramsArr[$paramsArrCount - 3];
+                               $paramsArr[$paramsArrCount - 3] = $paramsArr[$paramsArrCount - 4];
+                               $paramsArr[$paramsArrCount - 4] = $tmp;
                        }
                        $cmdLine = $path . ' ' . implode(' ', $paramsArr);
                }
index 41d069b..3dc2f0a 100644 (file)
@@ -508,7 +508,7 @@ class ExtensionManagementUtility {
                if ($relativePosition !== '') {
                        // Insert at specified position
                        $matchedPosition = ArrayUtility::filterByValueRecursive($relativeToField, $GLOBALS['TCA'][$table]['columns'][$field]['config']['items']);
-                       if (count($matchedPosition) > 0) {
+                       if (!empty($matchedPosition)) {
                                $relativeItemKey = key($matchedPosition);
                                if ($relativePosition === 'replace') {
                                        $GLOBALS['TCA'][$table]['columns'][$field]['config']['items'][$relativeItemKey] = $item;
@@ -920,7 +920,7 @@ class ExtensionManagementUtility {
                }
 
                // add additional configuration
-               if (is_array($moduleConfiguration) && count($moduleConfiguration) > 0) {
+               if (is_array($moduleConfiguration) && !empty($moduleConfiguration)) {
                        $GLOBALS['TBE_MODULES']['_configuration'][$fullModuleSignature] = $moduleConfiguration;
                }
        }
index 169529b..726ddde 100644 (file)
@@ -194,7 +194,7 @@ class ExtendedFileUtility extends BasicFileUtility {
                                                unset($this->fileCmdMap['upload'][$upload['data']]);
                                        }
                                }
-                               if (count($this->fileCmdMap['upload']) == 0) {
+                               if (empty($this->fileCmdMap['upload'])) {
                                        $this->writelog(1, 1, 108, 'No file was uploaded!', '');
                                }
                        }
@@ -206,7 +206,7 @@ class ExtendedFileUtility extends BasicFileUtility {
                                                unset($this->fileCmdMap['newfolder'][$key]);
                                        }
                                }
-                               if (count($this->fileCmdMap['newfolder']) === 0) {
+                               if (empty($this->fileCmdMap['newfolder'])) {
                                        $this->writeLog(6, 1, 108, 'No name for new folder given!', '');
                                }
                        }
@@ -360,7 +360,7 @@ class ExtendedFileUtility extends BasicFileUtility {
                                        . ' AND tablename != ' . $databaseConnection->fullQuoteStr('sys_file_metadata', $table)
                        );
                        $deleteFile = TRUE;
-                       if (count($refIndexRecords) > 0) {
+                       if (!empty($refIndexRecords)) {
                                $shortcutContent = array();
                                $brokenReferences = array();
 
index 28552b7..dcf88f7 100755 (executable)
@@ -3313,7 +3313,7 @@ Connection: close
                                if (self::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP'])) {
                                        $ip = self::trimExplode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
                                        // Choose which IP in list to use
-                                       if (count($ip)) {
+                                       if (!empty($ip)) {
                                                switch ($GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyHeaderMultiValue']) {
                                                        case 'last':
                                                                $ip = array_pop($ip);
@@ -3337,7 +3337,7 @@ Connection: close
                                if (self::cmpIP($_SERVER['REMOTE_ADDR'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP'])) {
                                        $host = self::trimExplode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
                                        // Choose which host in list to use
-                                       if (count($host)) {
+                                       if (!empty($host)) {
                                                switch ($GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyHeaderMultiValue']) {
                                                        case 'last':
                                                                $host = array_pop($host);
index b92b63e..3fd7d3e 100644 (file)
@@ -365,7 +365,7 @@ class RootlineUtility {
                $cacheTags = array('pageId_' . $page['uid']);
                if ($parentUid > 0) {
                        // Get rootline of (and including) parent page
-                       $mountPointParameter = count($this->parsedMountPointParameters) > 0 ? $this->mountPointParameter : '';
+                       $mountPointParameter = !empty($this->parsedMountPointParameters) ? $this->mountPointParameter : '';
                        /** @var $rootline \TYPO3\CMS\Core\Utility\RootlineUtility */
                        $rootline = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Utility\RootlineUtility::class, $parentUid, $mountPointParameter, $this->pageContext);
                        $rootline = $rootline->get();
index 0cdd07e..ff25539 100644 (file)
@@ -144,7 +144,7 @@ abstract class AbstractTestCase extends \TYPO3\CMS\Core\Tests\FunctionalTestCase
 
                $logEntries = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_log', 'error IN (1,2)', '', '', 1);
 
-               if (is_array($logEntries) && count($logEntries)) {
+               if (is_array($logEntries) && !empty($logEntries)) {
                        $message = $logEntries[0]['details'];
                }
 
index 166f0bf..53b5178 100644 (file)
@@ -674,7 +674,7 @@ class FunctionalTestCaseBootstrapUtility {
                                $lines .= is_int($key) ? $key . ' => ' : '\'' . $key . '\' => ';
                        }
                        if (is_array($value)) {
-                               if (count($value) > 0) {
+                               if (!empty($value)) {
                                        $lines .= $this->arrayExport($value, $level);
                                } else {
                                        $lines .= 'array(),' . chr(10);
index 7e3f1f6..8aa2816 100644 (file)
@@ -129,7 +129,7 @@ class ExtractorRegistryTest extends UnitTestCase {
                        ->setMethods(array('createExtractorInstance'))
                        ->getMock();
 
-               if (count($createsExtractorInstances) > 0) {
+               if (!empty($createsExtractorInstances)) {
                        $extractorRegistry->expects($this->any())
                                ->method('createExtractorInstance')
                                ->will($this->returnValueMap($createsExtractorInstances));
index a19fdef..35e25d2 100644 (file)
@@ -30,7 +30,7 @@ class RendererRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ->setMethods(array('createRendererInstance'))
                        ->getMock();
 
-               if (count($createsRendererInstances)) {
+               if (!empty($createsRendererInstances)) {
                        $rendererRegistry->expects($this->any())
                                ->method('createRendererInstance')
                                ->will($this->returnValueMap($createsRendererInstances));
index 9a74219..af7ef7a 100644 (file)
@@ -34,7 +34,7 @@ class TextExtractorRegistryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ->setMethods(array('createTextExtractorInstance'))
                        ->getMock();
 
-               if (count($createsTextExtractorInstances)) {
+               if (!empty($createsTextExtractorInstances)) {
                        $textExtractorRegistry->expects($this->any())
                                ->method('createTextExtractorInstance')
                                ->will($this->returnValueMap($createsTextExtractorInstances));