use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.
the class PHttpResponse method setRawCookies.
@Signature
public void setRawCookies(ArrayMemory rawCookies) {
this.rawCookies = rawCookies;
ArrayMemory cookies = new ArrayMemory();
ForeachIterator iterator = rawCookies.foreachIterator(false, false);
while (iterator.next()) {
cookies.putAsKeyString(iterator.getStringKey(), iterator.getValue().valueOfIndex("value").toImmutable());
}
this.cookies = cookies;
}
use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.
the class WrapConfiguration method set.
@Signature
public String set(String key, Memory value) {
String s = value.toString();
if (value.isArray()) {
s = StringUtils.join(value.toValue(ArrayMemory.class).toStringArray(), "|");
}
Object property = properties.setProperty(key, s);
return property == null ? null : property.toString();
}
use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.
the class FsUtils method hash.
@Signature
public static Memory hash(InputStream source, String algo, @Nullable Invoker invoker) throws NoSuchAlgorithmException {
MessageDigest messageDigest = MessageDigest.getInstance(algo);
byte[] buffer = new byte[BUFFER_SIZE];
int len;
try {
int sum = 0;
while ((len = source.read(buffer)) > 0) {
messageDigest.update(buffer, 0, len);
sum += len;
if (invoker != null) {
if (invoker.callAny(sum, len).toValue() == Memory.FALSE) {
break;
}
}
}
return StringMemory.valueOf(DigestUtils.bytesToHex(messageDigest.digest()));
} catch (FileNotFoundException e) {
return Memory.NULL;
} catch (IOException e) {
return Memory.NULL;
}
}
use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.
the class WrapXmlProcessor method __construct.
@Signature
public void __construct(final Environment env) throws ParserConfigurationException, TransformerConfigurationException {
transformerFactory = TransformerFactory.newInstance();
transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
builderFactory = DocumentBuilderFactory.newInstance();
builder = builderFactory.newDocumentBuilder();
builder.setErrorHandler(new ErrorHandler() {
@Override
public void warning(SAXParseException exception) throws SAXException {
if (onWarning != null) {
onWarning.callAny(new JavaException(env, exception));
}
}
@Override
public void error(SAXParseException exception) throws SAXException {
if (onError != null) {
onError.callAny(new JavaException(env, exception));
}
}
@Override
public void fatalError(SAXParseException exception) throws SAXException {
if (onFatalError != null) {
onFatalError.callAny(new JavaException(env, exception));
} else {
throw exception;
}
}
});
}
use of php.runtime.annotation.Reflection.Signature in project jphp by jphp-compiler.
the class PSqlResult method toArray.
@Signature
public ArrayMemory toArray(Environment env, boolean assoc) throws SQLException {
ResultSetMetaData metaData = resultSet.getMetaData();
ArrayMemory result = new ArrayMemory();
int count = metaData.getColumnCount();
for (int i = 0; i < count; i++) {
Memory value = getTyped(env, i);
if (assoc) {
result.putAsKeyString(metaData.getColumnLabel(i + 1), value);
} else {
result.add(value);
}
}
return result.toConstant();
}
Aggregations