Callable object representing callback to a routine. Performs dynamic binding to actual method and provides IPhpCallable interface.
Inheritance: IPhpCallable
Exemplo n.º 1
0
 /// <summary>
 /// Call a function by its name dynamically.
 /// </summary>
 /// <param name="function">Function name valid within current runtime context.</param>
 /// <param name="arguments">Arguments to be passed to the function call.</param>
 /// <returns>Returns value given from the function call.</returns>
 public PhpValue Call(string function, params PhpValue[] arguments) => PhpCallback.Create(function).Invoke(this, arguments);
Exemplo n.º 2
0
 public override bool Equals(PhpCallback other) => other is EmptyCallback;
Exemplo n.º 3
0
 public override bool Equals(PhpCallback other) => other is InvalidCallback;
Exemplo n.º 4
0
 public override bool Equals(PhpCallback other) => base.Equals(other) || Equals(other as MethodCallback);
Exemplo n.º 5
0
 public override bool Equals(PhpCallback other) => base.Equals(other) || Equals(other as ArrayCallback);
Exemplo n.º 6
0
 /// <summary>
 /// Creates a callable object from string value.
 /// </summary>
 public static IPhpCallable AsCallable(string value, RuntimeTypeHandle callerCtx) => PhpCallback.Create(value, callerCtx);
Exemplo n.º 7
0
 /// <summary>
 /// Public constructor of the class.
 /// </summary>
 /// <param name="handler">Error handler callback.</param>
 /// <param name="errors">Error types to be handled.</param>
 public ErrorHandlerRecord(PhpCallback handler, PhpError errors)
 {
     ErrorHandler = handler;
     ErrorTypes = errors;
 }
Exemplo n.º 8
0
            }                                                                                             // TODO: StringArray helper

            public override IPhpCallable AsCallable(ref PhpValue me) => PhpCallback.Create(me.WritableString.ToString());
Exemplo n.º 9
0
 /// <summary>
 /// Gets callable wrapper for dynamic object invocation.
 /// </summary>
 /// <param name="me"></param>
 /// <param name="callerCtx">Current caller type.</param>
 /// <returns>Instance of a callable object, cannot be <c>null</c>, can be invalid.</returns>
 public virtual IPhpCallable AsCallable(ref PhpValue me, RuntimeTypeHandle callerCtx) => PhpCallback.CreateInvalid();
Exemplo n.º 10
0
 /// <summary>
 /// Gets callable wrapper for dynamic object invocation.
 /// </summary>
 /// <param name="me"></param>
 /// <returns>Instance of a callable object, cannot be <c>null</c>, can be invalid.</returns>
 public virtual IPhpCallable AsCallable(ref PhpValue me) => PhpCallback.CreateInvalid();
Exemplo n.º 11
0
            }                                                                                             // TODO: StringArray helper

            public override IPhpCallable AsCallable(ref PhpValue me) => PhpCallback.Create(me.String);
Exemplo n.º 12
0
 /// <summary>
 /// Call a function by its name dynamically.
 /// </summary>
 /// <param name="function">Function name valid within current runtime context.</param>
 /// <param name="arguments">Arguments to be passed to the function call.</param>
 /// <returns>Returns value given from the function call.</returns>
 public PhpValue Call(string function, params object[] arguments) => PhpCallback.Create(function, default(RuntimeTypeHandle)).Invoke(this, PhpValue.FromClr(arguments));
Exemplo n.º 13
0
 /// <summary>
 /// Call a function by its name dynamically.
 /// </summary>
 /// <param name="function">Function name valid within current runtime context.</param>
 /// <param name="arguments">Arguments to be passed to the function call.</param>
 /// <returns>Returns value given from the function call.</returns>
 public PhpValue Call(string function, params PhpValue[] arguments) => PhpCallback.Create(function, default(RuntimeTypeHandle)).Invoke(this, arguments);
Exemplo n.º 14
0
 /// <summary>
 /// Call a function by its name dynamically.
 /// </summary>
 /// <param name="function">Function name valid within current runtime context.</param>
 /// <returns>Returns value given from the function call.</returns>
 public PhpValue Call(string function) => PhpCallback.Create(function, default(RuntimeTypeHandle)).Invoke(this, Array.Empty <PhpValue>());
Exemplo n.º 15
0
 /// <summary>
 /// Call a function by its name dynamically.
 /// </summary>
 /// <param name="function">Function name valid within current runtime context.</param>
 /// <param name="arguments">Arguments to be passed to the function call.</param>
 /// <returns>Returns value given from the function call.</returns>
 public PhpValue Call(string function, params object[] arguments) => PhpCallback.Create(function).Invoke(this, PhpValue.FromClr(arguments));
Exemplo n.º 16
0
 public override IPhpCallable AsCallable(ref PhpValue me, RuntimeTypeHandle callerCtx) => PhpCallback.Create(me.MutableString.ToString(), callerCtx);
Exemplo n.º 17
0
 /// <summary>
 /// Creates a callable object from string value.
 /// </summary>
 public static IPhpCallable AsCallable(string value) => PhpCallback.Create(value);
Exemplo n.º 18
0
 /// <summary>
 /// Gets value indicating this instance represents the same callback as <paramref name="other"/>.
 /// </summary>
 /// <param name="other">The other instance to compare with.</param>
 /// <returns>Both callbacks represents the same routine.</returns>
 public virtual bool Equals(PhpCallback other) => other != null && ReferenceEquals(_lazyResolved, other._lazyResolved) && _lazyResolved != null;
Exemplo n.º 19
0
 public override bool Equals(PhpCallback other) => base.Equals(other) || Equals(other as FunctionCallback);
Exemplo n.º 20
0
 public PhpValue Call(string function) => PhpCallback.Create(function).Invoke(this, Array.Empty <PhpValue>());