@Signature public WrapProcess redirectOutputToFile(File file) { processBuilder.redirectOutput(file); return this; }
@Override @Signature public Memory rewind(Environment env, Memory... args) { iterator = getWrappedObject().iterator(); if (iterator.hasNext()) { iteratorValue = new WrapElement(env, iterator.next()); } iteratorIndex = 0; 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 Memory wait(Environment env) { while (this.state == State.PENDING) { // loop. } if (this.state == State.FULFILLED) return this.value; if (this.state == State.REJECTED) { env.__throwException(this.value.toObject(BaseBaseException.class)); } return Memory.NULL; }
@Name("catch") @Signature public WrapPromise _catch(Environment env, @Nullable @Optional("null") Invoker onRejected) throws Exception { return this.then(env, null, onRejected); }
@Signature public Memory getClasses() { ArrayMemory result = ArrayMemory.createHashed(); for (NamespaceRecord record : namespaces.values()) { Collection<ClassRecord> classes = record.getClasses(); for (ClassRecord aClass : classes) { result.put(aClass.getName(), aClass); } } return result.toConstant(); }
@Signature public PHtmlEmail setMessage(String value) throws EmailException { htmlEmail.setMsg(value); return this; }
@Signature public PMarkdownOptions setRenderSuppressHtml(boolean value) { options.set(HtmlRenderer.SUPPRESS_HTML, value); return this; }
@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)); } }
@Runtime.FastMethod @Signature({ @Arg("callback") }) public static Memory of(Environment env, Memory... args) { Invoker invoker = Invoker.valueOf(env, null, args[0]); if (invoker == null) return Memory.NULL; return new ObjectMemory(new WrapInvoker(env, invoker)); } }
@Signature public WrapMongoIterable maxAwaitTime(long millis) { if (getWrappedObject() instanceof FindIterable) { return new WrapMongoIterable(this.__env__, ((FindIterable) getWrappedObject()).maxAwaitTime(millis, TimeUnit.MILLISECONDS)); } else { return this; } }
@Signature public static Memory current(Environment env, Memory... args){ return new ObjectMemory(new WrapEnvironment(env, env)); } }
@Signature({ @Arg("name"), @Arg(value = "package", nativeType = WrapPackage.class) }) public Memory setPackage(Environment env, Memory... args) { PackageManager packageManager = this.environment.getPackageManager(); packageManager.set(args[0].toString(), args[1].toObject(WrapPackage.class).getPackage()); return Memory.NULL; }
@Signature({ @Arg("name"), @Arg("value"), @Arg(value = "caseSensitive", optional = @Optional(value = "true", type = HintType.BOOLEAN)) }) public Memory defineConstant(Environment env, Memory... args){ Memory val = args[1].toValue(); if (val.isArray() || val.isObject()) env.exception("Argument 2 must be a scalar value"); if (!environment.defineConstant(args[0].toString(), val, args[2].toBoolean())) env.exception("Constant '%s' already registered", args[0]); return Memory.NULL; }
@Signature(@Arg("functionName")) public Memory importFunction(Environment env, Memory... args){ FunctionEntity functionEntity = env.fetchFunction(args[0].toString()); if (functionEntity == null) { env.exception(Messages.ERR_FUNCTION_NOT_FOUND.fetch(args[0])); return Memory.NULL; } environment.registerFunction(functionEntity); return Memory.NULL; }
@Signature public Memory getClasses(Environment env) { Collection<ClassEntity> classes = module.getClasses(); ArrayMemory result = new ArrayMemory(); for (ClassEntity aClass : classes) { ReflectionClass rf = new ReflectionClass(env); rf.setEntity(aClass); result.put(aClass.getName(), rf); } return result.toConstant(); }
@Signature public Memory getExitValue(Environment env, Memory... args) { try { return LongMemory.valueOf(getProcess().exitValue()); } catch (IllegalThreadStateException e) { return Memory.NULL; } }
@Signature public WrapProcess redirectInputFromFile(File file) { processBuilder.redirectInput(file); return this; }
@Signature public void register(Environment env) { if (loader == null) { env.getPackageManager().registerLoader(_getPackageLoader(env)); } else { env.exception("PackageLoader is already registered"); } }