private Env createEnv(QuercusPage page, BamEventType type,
String to, String from, Serializable value)
{
WriteStream out = new NullWriteStream();
Env env = new Env(_quercus, page, out, null, null);
JavaClassDef actorClassDef = env.getJavaClassDefinition(BamPhpActor.class);
env.setGlobalValue("_quercus_bam_actor", actorClassDef.wrap(env, this));
env.start();
JavaClassDef eventClassDef = env.getJavaClassDefinition(BamEventType.class);
Value typeValue = eventClassDef.wrap(env, type);
env.setGlobalValue("_quercus_bam_event_type", typeValue);
env.setGlobalValue("_quercus_bam_to", StringValue.create(to));
env.setGlobalValue("_quercus_bam_from", StringValue.create(from));
Value javaValue = NullValue.NULL;
if (value != null) {
JavaClassDef classDef = env.getJavaClassDefinition(value.getClass());
javaValue = classDef.wrap(env, value);
}
env.setGlobalValue("_quercus_bam_value", javaValue);
return env;
}