/// <summary> /// Binds the routine delegate. /// </summary> /// <returns>Instance to the delegate. Cannot be <c>null</c>.</returns> private PhpCallable BindNew(Context ctx) { var resolved = BindCore(ctx) ?? InvokeError; _lazyResolved = resolved; return(resolved); }
internal void AddOverload(MethodInfo method) { if (Array.IndexOf(_methods, method) < 0) { Array.Resize(ref _methods, _methods.Length + 1); _methods[_methods.Length - 1] = method; // _lazyDelegate = null; } }
internal void AddOverload(RuntimeMethodHandle handle) { if (!_handles.Contains(handle)) { var length = _handles.Length; Array.Resize(ref _handles, length + 1); _handles[length] = handle; // _lazyDelegate = null; } }
/// <summary> /// Binds the routine delegate. /// </summary> /// <returns>Instance to the delegate. Cannot be <c>null</c>.</returns> private PhpCallable BindNew(Context ctx) { var resolved = BindCore(ctx); if (resolved == null) { _flags |= CallbackFlags.IsInvalid; resolved = InvokeError; } // _lazyResolved = resolved; return(resolved); }
public CallableCallback(PhpCallable callable) { _lazyResolved = callable; }
public static PhpCallback Create(PhpCallable callable) => new CallableCallback(callable);
PhpCallable BindDelegate() { return(_lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Methods)); }
PhpCallable BindDelegate() => _lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Methods);
static PhpValue preg_replace(Context ctx, string pattern, string replacement, PhpCallable callback, PhpValue subject, int limit, ref long count) { var regex = new PerlRegex.Regex(pattern); // TODO: count // TODO: callback var subject_array = subject.AsArray(); if (subject_array == null) { return PhpValue.Create(regex.Replace(subject.ToStringOrThrow(ctx), replacement, limit)); } else { var arr = new PhpArray(subject_array, false); var enumerator = arr.GetFastEnumerator(); while (enumerator.MoveNext()) { var newvalue = regex.Replace(enumerator.CurrentValue.ToStringOrThrow(ctx), replacement, limit); enumerator.CurrentValue = PhpValue.Create(newvalue); } return PhpValue.Create(arr); } }
PhpCallable BindDelegate() { return(_lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Handles.Select(MethodBase.GetMethodFromHandle).ToArray())); }
/// <summary> /// Binds the routine delegate. /// </summary> /// <returns>Instance to the delegate. Cannot be <c>null</c>.</returns> private PhpCallable BindNew(Context ctx) { var resolved = BindCore(ctx) ?? InvokeError; _lazyResolved = resolved; return resolved; }
PhpCallable BindDelegate() { return _lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Methods.ToArray()); }