Pchp.Library.Arrays.MergeRecursive C# (CSharp) Method

MergeRecursive() private static method

Merges arrays recursively.
private static MergeRecursive ( PhpArray array, bool deepCopy ) : PhpArray
array Pchp.Core.PhpArray The first array to merge.
deepCopy bool Whether to deep copy merged items.
return Pchp.Core.PhpArray
        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;
        }