示例#1
0
        /// <summary>
        /// Sets a new level of error reporting.
        /// </summary>
        /// <param name="ctx">Current runtime context.</param>
        /// <param name="level">The new level.</param>
        /// <returns>The original level.</returns>
        public static int error_reporting(Context ctx, int level)
        {
            if ((level & (int)PhpErrorSets.All) == 0 && level != 0)
            {
                //PhpException.InvalidArgument("level");
                throw new ArgumentException(nameof(level));
            }

            var errctx = ctx.GetStatic<ErrorContext>();
            var result = (int)errctx.ReportErrors;
            errctx.ReportErrors = (PhpError)level & (PhpError)PhpErrorSets.All;
            return result;
        }
示例#2
0
 /// <summary>
 /// Cultures associated with cathegories.
 /// </summary>
 internal static CultureInfo[]/*!*/GetCultures(Context ctx) => ctx.GetStatic<Cultures>().Array;
示例#3
0
 /// <summary>
 /// Retrieves the current error reporting level.
 /// </summary>
 /// <param name="ctx">Current runtime context.</param>
 /// <returns>
 /// The bitmask of error types which are reported. Returns 0 if error reporting is disabled
 /// by means of @ operator.
 /// </returns>
 public static int error_reporting(Context ctx)
 {
     return ctx.ErrorReportingDisabled ? 0 : (int)ctx.GetStatic<ErrorContext>().ReportErrors;
 }