@Signature public static void setErr(Environment env, @Arg(typeClass = "php\\io\\Stream", nullable = true) Memory stream, Memory encoding) throws UnsupportedEncodingException { if (stream.isNull()) { System.setErr(null); } else { if (encoding.isNotNull()) { System.setErr(new PrintStream(Stream.getOutputStream(env, stream), true, encoding.toString())); } else { System.setErr(new PrintStream(Stream.getOutputStream(env, stream), true)); } } }
@Signature(@Arg("value")) public Memory set(Environment env, Memory... args) { this.local.set(args[0]); return Memory.NULL; }
@Override @Signature(@Arg("offset")) public Memory offsetUnset(Environment environment, Memory... memories) { throw new UnsupportedOperationException(); }
@Signature public static WrapPromise reject(Environment env, @Arg(typeClass = "Throwable") Memory error) { return new WrapPromise(env, new Callback<Memory, Memory[]>() { @Override public Memory call(Memory[] args) { // reject. return Invoker.create(env, args[1]).callAny(error); } }); }
@Signature public static void setErr(Environment env, @Arg(typeClass = "php\\io\\Stream", nullable = true) Memory stream) throws UnsupportedEncodingException { setOut(env, stream, Memory.NULL); }
@Signature({ @Arg("compiledLine"), }) public Memory getSourceLine(Environment env, Memory... args) { int sourceLine = getWrappedObject().getSourceLine(args[0].toInteger()); return LongMemory.valueOf(sourceLine); }
@Override @Signature(@Arg("offset")) public Memory offsetGet(Environment environment, Memory... memories) { Node node = getWrappedObject().item(memories[0].toInteger()); if (node == null) { return Memory.NULL; } if (node instanceof Element) { return ObjectMemory.valueOf(new WrapDomElement(environment, (Element) node)); } return ObjectMemory.valueOf(new WrapDomNode(environment, node)); }
@Override @Signature(@Arg("offset")) public Memory offsetGet(Environment env, Memory... args) { String value = userEnv.get(args[0].toString()); return value == null ? Memory.NULL : StringMemory.valueOf(value); }
@Signature public void setUserInfo(Environment env, @Nullable @Arg(type = ARRAY) Memory ui) { if (ui.isNull()) { getWrappedObject().setUserInfo(null); } else { UserInfoBean userInfo = ui.toValue(ArrayMemory.class).toBean(env, UserInfoBean.class); getWrappedObject().setUserInfo(userInfo); } }
@Signature(@Arg(value = "value", optional = @Reflection.Optional("null"))) public Memory __construct(Environment env, Memory... args) { this.local = new ThreadLocal<Memory>() { @Override protected Memory initialValue() { return args[0]; } }; return Memory.NULL; }
@Signature(@Arg(value = "names", type = HintType.ARRAY)) public Memory addConstants(Environment env, Memory... args) { for (Memory one : args[0].toValue(ArrayMemory.class)) { pkg.addConstant(one.toString()); } return Memory.NULL; } }
@Signature(@Arg(value = "names", type = HintType.ARRAY)) public Memory addClasses(Environment env, Memory... args) { for (Memory one : args[0].toValue(ArrayMemory.class)) { pkg.addClass(one.toString()); } return Memory.NULL; }
@Signature(@Arg(value = "names", type = HintType.ARRAY)) public Memory addFunctions(Environment env, Memory... args) { for (Memory one : args[0].toValue(ArrayMemory.class)) { pkg.addFunction(one.toString()); } return Memory.NULL; }
@Override @Signature(@Arg("offset")) synchronized public Memory offsetUnset(Environment env, Memory... args) { userEnv.remove(args[0].toString()); return Memory.NULL; }
@Signature public static void setOut(Environment env, @Arg(typeClass = "php\\io\\Stream", nullable = true) Memory stream) throws UnsupportedEncodingException { setOut(env, stream, Memory.NULL); }
@Signature public static void setIn(Environment env, @Arg(typeClass = "php\\io\\Stream", nullable = true) Memory stream) { if (stream.isNull()) { System.setIn(null); } else { System.setIn(Stream.getInputStream(env, stream)); } }