PhpInvokable BindDelegate() { var method = _delegate.GetMethodInfo(); if (!s_bound.TryGetValue(method, out _lazyInvokable)) // TODO: RW lock { lock (s_bound) { s_bound[method] = _lazyInvokable = Dynamic.BinderHelpers.BindToPhpInvokable(new[] { method }); } } // return(_lazyInvokable); }
/// <summary> /// Binds <see cref="PhpInvokable"/> to <see cref="PhpCallable"/> while wrapping arguments to a single argument of type <see cref="PhpArray"/>. /// </summary> internal static PhpCallable BindMagicCall(this PhpInvokable invokable, object target, string name) => (ctx, arguments) => invokable(ctx, target, new[] { (PhpValue)name, (PhpValue)PhpArray.New(arguments) });
/// <summary> /// Binds <see cref="PhpInvokable"/> to <see cref="PhpCallable"/> by fixing the target argument. /// </summary> internal static PhpCallable Bind(this PhpInvokable invokable, object target) => (ctx, arguments) => invokable(ctx, target, arguments);
PhpInvokable BindDelegate() { return(_lazyDelegate = Dynamic.BinderHelpers.BindToPhpInvokable(_methods, LateStaticType)); }
PhpInvokable BindDelegate() { return _lazyDelegate = Dynamic.BinderHelpers.BindToPhpInvokable(_methods); }