/// <summary> /// Merges arrays recursively. /// </summary> /// <param name="array">The first array to merge.</param> /// <param name="arrays">The next arrays to merge.</param> /// <param name="deepCopy">Whether to deep copy merged items.</param> /// <returns>An array containing items of all specified arrays.</returns> private static PhpArray MergeRecursive(PhpArray array, bool deepCopy, params PhpArray[] arrays) { if (array == null) return null; PhpArray result = new PhpArray(); array.AddTo(result, deepCopy); if (arrays != null) { for (int i = 0; i < arrays.Length; i++) { if (arrays[i] != null) { if (!MergeRecursiveInternal(result, arrays[i], deepCopy)) { //PhpException.Throw(PhpError.Warning, LibResources.GetString("recursion_detected")); throw new ArgumentException(); } } } } return result; }