/** * Merge two or more Maps, just like array_merge * * @static * * @param $maps,... A variable number of arguments, all to merge * * @return Map * * @throws Falcraft\Data\TypesException\InvalidArgumentException * if less than two arguments are provided * */ public static function merge() { if (func_num_args() < 2) { throw new Exception\InvalidArgumentException('Map->merge: Merge requires 2 or more arguments'); } else { $args = self::mapArgs(func_get_args()); $result = new Map(); foreach ($args as $val) { foreach ($val as $key => $ival) { $result->set($key, $ival); } } return $result; } }