Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 /// <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) });
Exemplo n.º 3
0
 /// <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);
Exemplo n.º 4
0
 PhpInvokable BindDelegate()
 {
     return(_lazyDelegate = Dynamic.BinderHelpers.BindToPhpInvokable(_methods, LateStaticType));
 }
Exemplo n.º 5
0
 PhpInvokable BindDelegate()
 {
     return _lazyDelegate = Dynamic.BinderHelpers.BindToPhpInvokable(_methods);
 }