Removed ArrayUtil::intersectKeys()
authorMatthias Schmidt <gravatronics@live.com>
Wed, 3 Aug 2011 15:29:03 +0000 (17:29 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 3 Aug 2011 15:29:03 +0000 (17:29 +0200)
`array_intersect_key()` is available as of PHP 5.1.0.

wcfsetup/install/files/lib/util/ArrayUtil.class.php

index 7ad7ab9d3cf2a25273df6c95dfd2d234f3a6ad1d..c99256734c1b2f10875ec0848f4ef9cf2fd17961 100644 (file)
@@ -102,34 +102,6 @@ class ArrayUtil {
                return $array;
        }
        
-       /**
-        * Computes the intersection of arrays using keys for comparison
-        * Alias to php array_intersect_key() function
-        *
-        * @param       array   $array1         The array with master keys to check. 
-        * @param       array   $array2         An array to compare keys against.
-        * @return                              Returns an associative array containing all the values of array1  which have matching keys that are present in all arguments. 
-        * @see                                 array_intersect_key
-        */
-       public static function intersectKeys($array1, $array2) {
-               if (!function_exists('array_intersect_key')) {
-                       $numberOfArguments = func_num_args();
-                       for ($i = 1; !empty($array1) && $i < $numberOfArguments; $i++) {
-                               $currentArray = func_get_arg($i);
-                               foreach (array_keys($array1) as $key) {
-                                       if (!isset($currentArray[$key])) {
-                                               unset($array1[$key]);
-                                       }
-                               }
-                       }
-                       return $array1;
-               } 
-               else {
-                       $parameters = func_get_args();
-                       return call_user_func_array('array_intersect_key', $parameters);
-               }
-       }
-       
        /**
         * Converts dos to unix newlines.
         *