Pchp.Library.Constants.get_defined_constants C# (CSharp) Method

get_defined_constants() public static method

Retrieves defined constants.
public static get_defined_constants ( Context ctx, bool categorize = false ) : PhpArray
ctx Pchp.Core.Context Current runtime context.
categorize bool Returns a multi-dimensional array with categories in the keys of the first dimension and constants and their values in the second dimension.
return Pchp.Core.PhpArray
        public static PhpArray get_defined_constants(Context ctx, bool categorize = false)
        {
            var result = new PhpArray();

            if (categorize)
            {
                throw new NotImplementedException();
            }
            else
            {
                foreach (var c in ctx.GetConstants())
                {
                    result.Add(c.Key, c.Value);
                }
            }

            //
            return result;
        }
    }