예제 #1
0
        /// <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);
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        internal void AddOverload(RuntimeMethodHandle handle)
        {
            if (!_handles.Contains(handle))
            {
                var length = _handles.Length;
                Array.Resize(ref _handles, length + 1);
                _handles[length] = handle;

                //
                _lazyDelegate = null;
            }
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
 public CallableCallback(PhpCallable callable)
 {
     _lazyResolved = callable;
 }
예제 #6
0
 public static PhpCallback Create(PhpCallable callable) => new CallableCallback(callable);
예제 #7
0
 PhpCallable BindDelegate()
 {
     return(_lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Methods));
 }
예제 #8
0
 PhpCallable BindDelegate() => _lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Methods);
예제 #9
0
파일: pcre.cs 프로젝트: iolevel/peachpie
        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);
            }
        }
예제 #10
0
 PhpCallable BindDelegate()
 {
     return(_lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Handles.Select(MethodBase.GetMethodFromHandle).ToArray()));
 }
예제 #11
0
 public CallableCallback(PhpCallable callable)
 {
     _lazyResolved = callable;
 }
예제 #12
0
        /// <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;
        }
예제 #13
0
 public static PhpCallback Create(PhpCallable callable) => new CallableCallback(callable);
예제 #14
0
        internal void AddOverload(RuntimeMethodHandle handle)
        {
            if (!_handles.Contains(handle))
            {
                var length = _handles.Length;
                Array.Resize(ref _handles, length + 1);
                _handles[length] = handle;

                //
                _lazyDelegate = null;
            }
        }
예제 #15
0
 PhpCallable BindDelegate()
 {
     return _lazyDelegate = Dynamic.BinderHelpers.BindToPhpCallable(Methods.ToArray());
 }