Example #1
0
        public static PhpCallback Create(PhpValue item1, PhpValue item2, RuntimeTypeHandle callerCtx = default, object callerObj = null)
        {
            if (item2.IsString(out var method))
            {
                if (item1.AsObject() != null || item1.IsString())
                {
                    // creates callback from an array,
                    // array entries must be dereferenced so they cannot be changed gainst
                    return(new ArrayCallback(item1.GetValue(), method, callerCtx)
                    {
                        Target = callerObj
                    });
                }
            }

            //
            return(CreateInvalid());
        }