Changeset 2899

Show
Ignore:
Timestamp:
06/25/2008 03:04:09 AM (4 months ago)
Author:
armen
Message:

Removed extra called in foreaches.

Location:
trunk/system/libraries
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Calendar_Event.php

    r2675 r2899  
    240240                } 
    241241 
    242                 foreach (array_diff_key($this->conditions, $tested) as $key => $value) 
     242                $conditions = array_diff_key($this->conditions, $tested); 
     243 
     244                foreach ($conditions as $key => $value) 
    243245                { 
    244246                        if ($key === 'callback') 
  • trunk/system/libraries/Database.php

    r2862 r2899  
    369369                } 
    370370 
    371                 foreach( (array) $table as $t) 
     371                foreach ((array) $table as $t) 
    372372                { 
    373373                        $this->join['tables'][] = $this->driver->escape_column($this->config['table_prefix'].$t); 
  • trunk/system/libraries/ORM.php

    r2681 r2899  
    519519                        if ($action === 'add' AND is_array(current($args))) 
    520520                        { 
    521                                 foreach (current($args) as $key => $val) 
     521                                $arg = current($args); 
     522 
     523                                foreach ($arg as $key => $val) 
    522524                                { 
    523525                                        // Fill object with data from array 
     
    756758                if ( ! $array->submitted()) 
    757759                { 
    758                         foreach ($array->safe_array() as $key => $val) 
     760                        $safe_array = $array->safe_array(); 
     761                         
     762                        foreach ($safe_array as $key => $val) 
    759763                        { 
    760764                                // Pre-fill data 
     
    766770                if ($status = $array->validate()) 
    767771                { 
    768                         foreach ($array->safe_array() as $key => $val) 
     772                        $safe_array = $array->safe_array(); 
     773 
     774                        foreach ($safe_array as $key => $val) 
    769775                        { 
    770776                                // Set new data 
     
    864870                                } 
    865871 
    866                                 foreach (array_diff($new, $cur) as $key) 
     872                                $keys = array_diff($new, $cur); 
     873 
     874                                foreach ($keys as $key) 
    867875                                { 
    868876                                        // Create new relationships 
  • trunk/system/libraries/Router.php

    r2898 r2899  
    9494 
    9595                        $found = FALSE; 
    96                         foreach (Config::include_paths() as $dir) 
     96                        $paths = Config::include_paths(); 
     97 
     98                        foreach ($paths as $dir) 
    9799                        { 
    98100                                // Search within controllers only 
  • trunk/system/libraries/Session.php

    r2852 r2899  
    436436        public function delete($keys) 
    437437        { 
    438                 foreach (func_get_args() as $key) 
     438                $args = func_get_args(); 
     439 
     440                foreach ($args as $key) 
    439441                { 
    440442                        if (isset(self::$protect[$key])) 
  • trunk/system/libraries/URI.php

    r2310 r2899  
    151151 
    152152                $associative = array(); 
    153                 foreach (array_chunk($array, 2) as $pair) 
     153                $pairs       = array_chunk($array, 2); 
     154 
     155                foreach ($pairs as $pair) 
    154156                { 
    155157                        // Add the key/value pair to the associative array 
  • trunk/system/libraries/Validation.php

    r2869 r2899  
    622622                        { 
    623623                                $messages = array(); 
    624                                 foreach (array_keys($this->messages) as $input) 
     624                                $keys     = array_keys($this->messages); 
     625 
     626                                foreach ($keys as $input) 
    625627                                { 
    626628                                        $messages[] = $this->message($input); 
  • trunk/system/libraries/drivers/Cache/Memcache.php

    r2430 r2899  
    2424                $this->flags = Config::item('cache_memcache.compression') ? MEMCACHE_COMPRESSED : 0; 
    2525 
    26                 foreach (Config::item('cache_memcache.servers') as $server) 
     26                $servers = Config::item('cache_memcache.servers'); 
     27 
     28                foreach ($servers as $server) 
    2729                { 
    2830                        // Make sure all required keys are set