/// <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);
public override bool Equals(PhpCallback other) => other is EmptyCallback;
public override bool Equals(PhpCallback other) => other is InvalidCallback;
public override bool Equals(PhpCallback other) => base.Equals(other) || Equals(other as MethodCallback);
public override bool Equals(PhpCallback other) => base.Equals(other) || Equals(other as ArrayCallback);
/// <summary> /// Creates a callable object from string value. /// </summary> public static IPhpCallable AsCallable(string value, RuntimeTypeHandle callerCtx) => PhpCallback.Create(value, callerCtx);
/// <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; }
} // TODO: StringArray helper public override IPhpCallable AsCallable(ref PhpValue me) => PhpCallback.Create(me.WritableString.ToString());
/// <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();
/// <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();
} // TODO: StringArray helper public override IPhpCallable AsCallable(ref PhpValue me) => PhpCallback.Create(me.String);
/// <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));
/// <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);
/// <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>());
/// <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));
public override IPhpCallable AsCallable(ref PhpValue me, RuntimeTypeHandle callerCtx) => PhpCallback.Create(me.MutableString.ToString(), callerCtx);
/// <summary> /// Creates a callable object from string value. /// </summary> public static IPhpCallable AsCallable(string value) => PhpCallback.Create(value);
/// <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;
public override bool Equals(PhpCallback other) => base.Equals(other) || Equals(other as FunctionCallback);
public PhpValue Call(string function) => PhpCallback.Create(function).Invoke(this, Array.Empty <PhpValue>());