InitOutput() protected method

Initialize output of this context. To be used by the context constructor.
protected InitOutput ( Stream output ) : void
output Stream
return void
Esempio n. 1
0
        /// <summary>
        /// Create default context with no output.
        /// </summary>
        public static Context CreateEmpty()
        {
            var ctx = new Context();

            ctx.InitOutput(null);

            return(ctx);
        }
Esempio n. 2
0
        /// <summary>
        /// Create default context with no output.
        /// </summary>
        /// <param name="cmdargs">
        /// Optional arguments to be passed to PHP <c>$argv</c> and <c>$argc</c> global variables.
        /// If the array is empty, variables are not created.
        /// </param>
        public static Context CreateEmpty(params string[] cmdargs)
        {
            var ctx = new Context();

            ctx.InitOutput(null);
            ctx.InitSuperglobals();

            if (cmdargs != null && cmdargs.Length != 0)
            {
                ctx.InitializeArgvArgc(cmdargs);
            }

            //
            return(ctx);
        }
Esempio n. 3
0
        /// <summary>
        /// Create default context with no output.
        /// </summary>
        /// <param name="cmdargs">
        /// Optional arguments to be passed to PHP <c>$argv</c> and <c>$argc</c> global variables.
        /// If the array is empty, variables are not created.
        /// </param>
        public static Context CreateEmpty(params string[] cmdargs)
        {
            var ctx = new Context()
            {
                RootPath = Directory.GetCurrentDirectory(),
                EnableImplicitAutoload = true,
            };

            ctx.WorkingDirectory = ctx.RootPath;
            ctx.InitOutput(null);
            ctx.InitSuperglobals();

            if (cmdargs != null && cmdargs.Length != 0)
            {
                ctx.InitializeArgvArgc(cmdargs);
            }

            //
            return(ctx);
        }