Search in sources :

Example 21 with Signature

use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.

the class PSqlDriverManager method getPool.

@Signature
public static PSqlConnectionPool getPool(Environment env, String url, String driverName, @Nullable Properties properties) throws SQLException {
    HikariConfig config = new HikariConfig(properties == null ? new Properties() : properties);
    if (config.getDataSourceClassName() == null) {
        config.setDataSourceClassName(dataSourceClasses.get(driverName));
    }
    HikariDataSource pool = new HikariDataSource(config);
    pool.setDriverClassName(_getDriverClass(driverName));
    pool.setJdbcUrl("jdbc:" + url);
    return new PSqlConnectionPool(env, pool);
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) HikariConfig(com.zaxxer.hikari.HikariConfig) Properties(java.util.Properties) Signature(php.runtime.annotation.Reflection.Signature)

Example 22 with Signature

use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.

the class ReflectionFunctionAbstract method getExtension.

@Signature
public Memory getExtension(Environment env, Memory... args) {
    if (getClosureEntity() != null)
        return Memory.NULL;
    Extension extension = getEntity().getExtension();
    if (extension == null)
        return Memory.NULL;
    else {
        ReflectionExtension ext = new ReflectionExtension(env, env.fetchClass("ReflectionExtension"));
        ext.setExtension(extension);
        return new ObjectMemory(ext);
    }
}
Also used : Extension(php.runtime.ext.support.Extension) ObjectMemory(php.runtime.memory.ObjectMemory) Signature(php.runtime.annotation.Reflection.Signature)

Example 23 with Signature

use of php.runtime.annotation.Reflection.Signature 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;
    }
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) TrueMemory(php.runtime.memory.TrueMemory) Memory(php.runtime.Memory) ArrayMemory(php.runtime.memory.ArrayMemory) LongMemory(php.runtime.memory.LongMemory) StringMemory(php.runtime.memory.StringMemory) Signature(php.runtime.annotation.Reflection.Signature)

Example 24 with Signature

use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.

the class FsUtils method hasExt.

@Signature
public static boolean hasExt(Environment env, String path, Memory extensions, boolean ignoreCase) {
    Set<String> exts = new HashSet<>();
    if (extensions.isTraversable()) {
        ForeachIterator iterator = extensions.getNewIterator(env);
        while (iterator.next()) {
            String value = iterator.getValue().toString();
            if (ignoreCase) {
                value = value.toLowerCase();
            }
            exts.add(value);
        }
    } else {
        exts.add(ignoreCase ? extensions.toString().toLowerCase() : extensions.toString());
    }
    String ext = ext(path);
    if (ignoreCase && ext != null) {
        ext = ext.toLowerCase();
    }
    return exts.contains(ext);
}
Also used : ForeachIterator(php.runtime.lang.ForeachIterator) HashSet(java.util.HashSet) Signature(php.runtime.annotation.Reflection.Signature)

Example 25 with Signature

use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.

the class WrapDomElement method getAttributes.

@Signature
public ArrayMemory getAttributes() {
    NamedNodeMap attributes = getWrappedObject().getAttributes();
    ArrayMemory result = new ArrayMemory();
    for (int i = 0; i < attributes.getLength(); i++) {
        Attr item = (Attr) attributes.item(i);
        result.putAsKeyString(item.getName(), StringMemory.valueOf(item.getValue()));
    }
    return result.toConstant();
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) Signature(php.runtime.annotation.Reflection.Signature)

Aggregations

Signature (php.runtime.annotation.Reflection.Signature)30 ArrayMemory (php.runtime.memory.ArrayMemory)8 InputStream (java.io.InputStream)4 Memory (php.runtime.Memory)4 ForeachIterator (php.runtime.lang.ForeachIterator)4 StringMemory (php.runtime.memory.StringMemory)4 ZipEntry (java.util.zip.ZipEntry)2 DOMSource (javax.xml.transform.dom.DOMSource)2 StreamResult (javax.xml.transform.stream.StreamResult)2 Stream (php.runtime.ext.core.classes.stream.Stream)2 WrapTime (php.runtime.ext.core.classes.time.WrapTime)2 LongMemory (php.runtime.memory.LongMemory)2 Intent (android.content.Intent)1 Button (android.widget.Button)1 EditText (android.widget.EditText)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 HikariConfig (com.zaxxer.hikari.HikariConfig)1 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1