本文整理了Java中php.runtime.env.Environment.getGlobals()
方法的一些代码示例,展示了Environment.getGlobals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getGlobals()
方法的具体详情如下:
包路径:php.runtime.env.Environment
类名称:Environment
方法名:getGlobals
暂无
代码示例来源:origin: jphp-group/jphp
public Memory include(Environment env) throws Throwable {
try {
return (Memory) nativeMethod.invoke(null, env, argsMock, env.getGlobals());
} catch (InvocationTargetException e){
return env.__throwException(e);
}
}
代码示例来源:origin: jphp-group/jphp
@Override
public Bindings createBindings() {
return new JPHPBindings(environment.getGlobals());
}
代码示例来源:origin: jphp-group/jphp
public Memory eval(String code) throws Throwable {
return eval(code, getGlobals());
}
代码示例来源:origin: jphp-group/jphp
public Memory includeNoThrow(Environment env){
return includeNoThrow(env, env.getGlobals());
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory getGlobals(Environment env, Memory... args) {
return environment.getGlobals().toImmutable();
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("name"))
public Memory hasGlobal(Environment env, Memory... args) {
return environment.getGlobals().containsKey(args[0].toString()) ? Memory.TRUE : Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("name"))
public Memory getGlobal(Environment env, Memory... args) {
return environment.getGlobals().valueOfIndex(args[0]).toImmutable();
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg("name"), @Arg(value = "value", optional = @Optional("null"))
})
public Memory addSuperGlobal(Environment env, Memory... args) {
if (hasSuperGlobal(env, args[0]).toBoolean()) {
environment.exception("Super-global variable $%s already exists", args[0]);
}
environment.getScope().superGlobals.add(args[0].toString());
environment.getGlobals().putAsKeyString(args[0].toString(), args[1].toImmutable());
return Memory.UNDEFINED;
}
代码示例来源:origin: jphp-group/jphp
environment.getGlobals().put("argv", argv);
environment.getGlobals().put("argc", LongMemory.valueOf(argv.size()));
代码示例来源:origin: jphp-group/jphp
@SuppressWarnings("unchecked")
protected Memory includeResource(String name, ArrayMemory globals){
ByteArrayOutputStream output = new ByteArrayOutputStream();
Environment environment;
if (isConcurrent()) {
environment = new ConcurrentEnvironment(newScope(), output);
} else {
environment = new Environment(newScope(), output);
}
File file = new File(Thread.currentThread().getContextClassLoader().getResource("resources/" + name).getFile());
Context context = new Context(file);
JvmCompiler compiler = new JvmCompiler(environment, context, getSyntax(context));
ModuleEntity module = compiler.compile();
environment.getScope().loadModule(module);
try {
environment.registerModule(module);
} catch (Throwable throwable) {
throw new RuntimeException(throwable);
}
if (globals != null)
environment.getGlobals().putAll(globals);
Memory memory = module.includeNoThrow(environment, environment.getGlobals());
try {
environment.doFinal();
} catch (Throwable throwable) {
throw new RuntimeException(throwable);
}
lastOutput = output.toString();
return memory;
}
代码示例来源:origin: jphp-group/jphp
environment.getModuleManager().addModule(context.getFileName(), module);
Memory memory = module.includeNoThrow(environment, environment.getGlobals());
} catch (ErrorException e) {
if (withErrors){
内容来源于网络,如有侵权,请联系作者删除!