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

array_fill_keys() public static method

public static array_fill_keys ( PhpArray keys, PhpValue value ) : PhpArray
keys Pchp.Core.PhpArray
value Pchp.Core.PhpValue
return Pchp.Core.PhpArray
        public static PhpArray array_fill_keys(PhpArray keys, PhpValue value)
        {
            if (keys == null)
            {
                // PhpException.ArgumentNull("keys");
                // return null;
                throw new ArgumentNullException();
            }

            var result = new PhpArray(keys.Count);
            var iterator = keys.GetFastEnumerator();
            while (iterator.MoveNext())
            {
                IntStringKey key;
                if (Core.Convert.TryToIntStringKey(iterator.CurrentValue, out key) && !result.ContainsKey(key))
                {
                    result[key] = value;
                }
            }

            // makes deep copies of all added items:
            //result.InplaceCopyOnReturn = true;
            return result;
        }