Beispiel #1
0
        public static ReflectionObject __construct(Env env, Value val)
        {
            if (!val.isObject())
            {
                throw new ReflectionException(env, "parameter must be an object");
            }

            ObjectValue obj = (ObjectValue)val.toObject(env);

            return(new ReflectionObject(obj.getQuercusClass()));
        }
        public AbstractIteratorImpl(Env env,
                                    ObjectValue obj)
        {
            _env    = env;
            _qClass = obj.getQuercusClass();
            _obj    = obj;

            if (!obj.isA(env, "iterator"))
            {
                throw new IllegalStateException(L.l("'{0}' @is an invalid iterator", obj));
            }

            _currentFun = _qClass.getFunction(env.createString("current"));
            _keyFun     = _qClass.getFunction(env.createString("key"));
            _nextFun    = _qClass.getFunction(env.createString("next"));
            _rewindFun  = _qClass.getFunction(env.createString("rewind"));
            _validFun   = _qClass.getFunction(env.createString("valid"));

            _rewindFun.callMethod(_env, _qClass, _obj);

            _needNext = false;
        }