[~TASK] Extbase (Utility): Performance optimization: changed while(list() to foreach...
authorJochen Rau <j.rau@web.de>
Tue, 9 Mar 2010 21:44:11 +0000 (21:44 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 9 Mar 2010 21:44:11 +0000 (21:44 +0000)
typo3/sysext/extbase/Classes/Utility/Arrays.php
typo3/sysext/extbase/Classes/Utility/Extension.php

index 616269e..dea93fa 100644 (file)
@@ -47,10 +47,9 @@ class Tx_Extbase_Utility_Arrays {
         */
        static public function integerExplode($delimiter, $string) {
                $chunksArr = explode($delimiter, $string);
-               while (list($key, $value) = each($chunksArr)) {
+               foreach ($chunksArr as $key => $value) {
                        $chunks[$key] = intval($value);
                }
-               reset($chunks);
                return $chunks;
        }
 
@@ -88,8 +87,7 @@ class Tx_Extbase_Utility_Arrays {
         * @api
         */
        static public function arrayMergeRecursiveOverrule(array $firstArray, array $secondArray, $dontAddNewKeys = FALSE, $emptyValuesOverride = TRUE) {
-               reset($secondArray);
-               while (list($key, $value) = each($secondArray)) {
+               foreach ($secondArray as $key => $value) {
                        if (array_key_exists($key, $firstArray) && is_array($firstArray[$key])) {
                                if (is_array($secondArray[$key])) {
                                        $firstArray[$key] = self::arrayMergeRecursiveOverrule($firstArray[$key], $secondArray[$key], $dontAddNewKeys, $emptyValuesOverride);
index ffb227d..a5ee268 100644 (file)
@@ -472,7 +472,7 @@ tt_content.list.20.' . $pluginSignature . ' {
 
                $returnValue = false;
                // Iterate with while since we need the current array position:
-               while (list(,$token) = each($tokenList)) {
+               foreach ($tokenList as $token) {
                        // parse token (see http://www.php.net/manual/en/function.token-get-all.php for format of token list)
                        if (is_array($token)) {
                                list($id, $text) = $token;