use of php.runtime.memory.ArrayMemory in project jphp by jphp-compiler.
the class WrapTimeZone method __construct.
@Signature({ @Arg("rawOffset"), @Arg("ID"), @Arg(value = "properties", type = HintType.ARRAY, optional = @Optional("null")) })
public Memory __construct(Environment env, Memory... args) {
if (args[2].isNull()) {
timeZone = new SimpleTimeZone(args[0].toInteger(), args[1].toString());
} else {
ArrayMemory props = args[2].toValue(ArrayMemory.class);
int startMonth = props.valueOfIndex("start_month").toInteger();
int startDay = props.valueOfIndex("start_day").toInteger();
int startDayOfWeek = props.valueOfIndex("start_day_of_week").toInteger();
int startTime = props.valueOfIndex("start_time").toInteger();
int endMonth = props.valueOfIndex("end_month").toInteger();
int endDay = props.valueOfIndex("end_day").toInteger();
int endDayOfWeek = props.valueOfIndex("end_day_of_week").toInteger();
int endTime = props.valueOfIndex("end_time").toInteger();
timeZone = new SimpleTimeZone(args[0].toInteger(), args[1].toString(), startMonth, startDay, startDayOfWeek, startTime, endMonth, endDay, endDayOfWeek, endTime);
}
return Memory.NULL;
}
use of php.runtime.memory.ArrayMemory in project jphp by jphp-compiler.
the class WrapConfiguration method getArray.
@Signature
public Memory getArray(String key, ArrayMemory def) {
if (has(key)) {
Memory memory = get(key);
String[] split = StringUtils.split(memory.toString(), '|');
ArrayMemory result = new ArrayMemory();
for (String s : split) {
result.add(s.trim());
}
return result.toConstant();
} else {
return def;
}
}
use of php.runtime.memory.ArrayMemory in project jphp by jphp-compiler.
the class WrapClassLoader method _getSplClassLoader.
protected synchronized SplClassLoader _getSplClassLoader(Environment env) {
if (splClassLoader == null) {
ArrayMemory callback = new ArrayMemory();
callback.add(this);
callback.add("loadClass");
Invoker invoker = Invoker.valueOf(env, null, callback);
splClassLoader = new SplClassLoader(invoker, callback);
}
return splClassLoader;
}
use of php.runtime.memory.ArrayMemory in project jphp by jphp-compiler.
the class WrapEnvironment method getPackages.
@Signature
public Memory getPackages(Environment env, Memory... args) {
PackageManager packageManager = this.environment.getPackageManager();
ArrayMemory result = new ArrayMemory();
for (String name : packageManager.names()) {
result.add(new WrapPackage(env, packageManager.fetch(name)));
}
return result.toConstant();
}
use of php.runtime.memory.ArrayMemory in project jphp by jphp-compiler.
the class ReflectionClass method getProperties.
@Signature(@Arg(value = "filter", optional = @Optional("NULL")))
public Memory getProperties(Environment env, Memory... args) {
int mod = args[0].isNull() ? -1 : args[0].toInteger();
ArrayMemory result = new ArrayMemory();
ClassEntity classEntity = env.fetchClass("ReflectionProperty");
if (mod == -1 || (mod & ReflectionProperty.IS_STATIC) == ReflectionProperty.IS_STATIC) {
for (PropertyEntity e : entity.getStaticProperties()) {
ReflectionProperty prop = new ReflectionProperty(env, classEntity);
prop.setEntity(e);
result.add(new ObjectMemory(prop));
}
}
for (PropertyEntity e : entity.getProperties()) {
if (checkModifiers(e, mod)) {
ReflectionProperty prop = new ReflectionProperty(env, classEntity);
prop.setEntity(e);
result.add(new ObjectMemory(prop));
}
}
return result.toConstant();
}
Aggregations