static Variant HHVM_METHOD(IntlTimeZone, getID) { TZ_GET(data, this_, false); icu::UnicodeString id; data->timezone()->getID(id); UErrorCode error = U_ZERO_ERROR; String ret(u8(id, error)); if (U_FAILURE(error)) { s_intl_error->set(error, "intltz_get_id: Could not convert id to UTF-8"); return false; } return ret; }
static bool HHVM_METHOD(IntlTimeZone, getOffset, double date, bool local, VRefParam rawOffset, VRefParam dstOffset) { TZ_GET(data, this_, false); UErrorCode error = U_ZERO_ERROR; int32_t rawOff, dstOff; data->timezone()->getOffset(date, (UBool)local, rawOff, dstOff, error); if (U_FAILURE(error)) { data->setError(error, "intltz_get_offset: error obtaining offset"); return false; } rawOffset = rawOff; dstOffset = dstOff; return true; }
static Variant HHVM_METHOD(IntlTimeZone, getDisplayName, bool isDaylight, int64_t style, const String& locale) { if (!IntlTimeZone::isValidStyle(style)) { s_intl_error->set(U_ILLEGAL_ARGUMENT_ERROR, "intltz_get_display_name: wrong display type"); return false; } TZ_GET(data, this_, false); icu::UnicodeString result; data->timezone()->getDisplayName((UBool)isDaylight, (icu::TimeZone::EDisplayType)style, icu::Locale::createFromName( localeOrDefault(locale).c_str()), result); UErrorCode error = U_ZERO_ERROR; String ret(u8(result, error)); TZ_CHECK(data, error, false); return ret; }
static bool HHVM_METHOD(IntlTimeZone, useDaylightTime) { TZ_GET(data, this_, false); return data->timezone()->useDaylightTime(); }
static bool HHVM_METHOD(IntlTimeZone, hasSameRules, CObjRef otherTimeZone) { TZ_GET(obj1, this_, false); TZ_GET(obj2, otherTimeZone, false); return obj1->timezone()->hasSameRules(*obj2->timezone()); }
static Variant HHVM_METHOD(IntlTimeZone, getRawOffset) { TZ_GET(data, this_, false); return data->timezone()->getRawOffset(); }
static String HHVM_METHOD(IntlTimeZone, getErrorMessage) { TZ_GET(data, this_, null_string); return data->getErrorMessage(); }
static int64_t HHVM_METHOD(IntlTimeZone, getErrorCode) { TZ_GET(data, this_, 0); return data->getErrorCode(); }
static int64_t HHVM_METHOD(IntlTimeZone, getDSTSavings) { TZ_GET(data, this_, -1); return data->timezone()->getDSTSavings(); }
static bool HHVM_METHOD(IntlTimeZone, hasSameRules, const Object& otherTimeZone) { TZ_GET(obj1, this_, false); TZ_GET(obj2, otherTimeZone.get(), false); return obj1->timezone()->hasSameRules(*obj2->timezone()); }