TypedValue* HHVM_FN(getdate)(ActRec* ar) { try { int64_t timestamp = getArgStrict<KindOfInt64>(ar, 0, TimeStamp::Current()); return arReturn(ar, getdateImpl(timestamp)); } catch (const IncoercibleArgumentException& e) { return arReturn(ar, false); } }
TypedValue* HHVM_FN(localtime)(ActRec* ar) { try { int64_t timestamp = getArgStrict<KindOfInt64>(ar, 0, TimeStamp::Current()); bool associative = getArgStrict<KindOfBoolean>(ar, 1, false); return arReturn(ar, localtimeImpl(timestamp, associative)); } catch (const IncoercibleArgumentException& e) { return arReturn(ar, false); } }
static TypedValue* serialize_vars_helper(ActRec* ar) { auto wddxPacket = req::make<WddxPacket>(empty_string_variant_ref, true, true); int start_index = 0; for (int i = start_index; i < ar->numArgs(); i++) { auto const tv = getArg(ar, i); find_var_recursive(tv, wddxPacket); } Variant packet = wddxPacket->packet_end(); return arReturn(ar, std::move(packet)); }
static TypedValue* add_vars_helper(ActRec* ar) { int start_index = 1; Resource packet_id{getArg<KindOfResource>(ar, 0)}; auto wddxPacket = cast<WddxPacket>(packet_id); for (int i = start_index; i < ar->numArgs(); i++) { auto const tv = getArg(ar, i); find_var_recursive(tv, wddxPacket); } return arReturn(ar, true); }
static TypedValue* serialize_vars_helper(ActRec* ar) { WddxPacket* wddxPacket = NEWOBJ(WddxPacket)(empty_string_variant_ref, true, true); int start_index = 0; for (int i = start_index; i < ar->numArgs(); i++) { auto const tv = getArg(ar, i); find_var_recursive(tv, wddxPacket); } const std::string packet = wddxPacket->packet_end(); Variant strHolder = makeStaticString(packet); return arReturn(ar, strHolder); }
TypedValue* HHVM_FUNCTION(pack, ActRec* ar) { int num = ar->numArgs(); String format(getArg<KindOfString>(ar,0)); Array extra = Array::Create(); for (int i = 1; i<num; i++) { extra.append(getArgVariant(ar,i)); } Variant result = ZendPack().pack(format, extra); // pack() returns false if there was an error if (!result.isBoolean()) { tvCastToStringInPlace(result.asTypedValue()); } return arReturn(ar, std::move(result)); }