internal static PhpArray StringKeysToLower(PhpArray/*!*/ array)
{
if (array == null)
{
//PhpException.ArgumentNull("array");
//return null;
throw new ArgumentNullException();
}
PhpArray result = new PhpArray();
var textInfo = System.Globalization.CultureInfo.CurrentCulture.TextInfo; // cache current culture to avoid repetitious CurrentCulture.get
using (var iterator = array.GetFastEnumerator())
while (iterator.MoveNext())
{
var entry = iterator.Current;
if (entry.Key.IsString)
{
result[textInfo.ToLower(entry.Key.String)] = entry.Value;
}
else
result[entry.Key] = entry.Value;
}
return result;
}