Add <<__NativeData("Type")>> registry for over-allocating ObjectData
[hiphop-php.git] / hphp / runtime / ext / icu / ext_icu_timezone.php
blobe7948692da2b25302f430f7d98fee5810408670e
1 <?hh
3 <<__NativeData("IntlTimeZone")>>
4 class IntlTimeZone {
6 /**
7 * Objects are only created wit the static create functions
8 */
9 public final function __construct() {
10 throw new Exception("An object of this type cannot be created ".
11 "with the new operator");
14 /**
15 * Get the number of IDs in the equivalency group that includes the given
16 * ID
18 * @param string $zoneId -
20 * @return integer -
22 <<__Native>>
23 public static function countEquivalentIDs(string $zoneId): mixed;
25 <<__Native>>
26 public static
27 function createTimeZoneIDEnumeration(int $zonetype,
28 string $region = "",
29 ?int $offset = null): mixed;
31 /**
32 * Create a new copy of the default timezone for this host
34 * @return IntlTimeZone -
36 <<__Native>>
37 public static function createDefault(): IntlTimeZone;
39 /**
40 * Get an enumeration over time zone IDs associated with the
41 * given country or offset
43 * @param mixed $countryOrRawOffset -
45 * @return IntlIterator -
47 <<__Native>>
48 public static
49 function createEnumeration(mixed $countryOrRawOffset = null): mixed;
51 /**
52 * Create a timezone object for the given ID
54 * @param string $zoneId -
56 * @return IntlTimeZone -
58 <<__Native>>
59 public static
60 function createTimeZone(string $zoneId): IntlTimeZone;
62 /**
63 * Create a timezone object from
65 * @param DateTimeZone $zoneId -
67 * @return IntlTimeZone -
69 public static
70 function fromDateTimeZone(DateTimeZone $zoneId): IntlTimeZone {
71 return self::createTimeZone($zoneId->name());
74 /**
75 * Get the canonical system timezone ID or the normalized custom time zone
76 * ID for the given time zone ID
78 * @param string $zoneId -
79 * @param bool $isSystemID -
81 * @return string -
83 <<__Native>>
84 public static
85 function getCanonicalID(string $zoneId, mixed &$isSystemID = null): mixed;
88 <<__Native>>
89 public static function getRegion(string $str): mixed;
91 /**
92 * Get a name of this time zone suitable for presentation to the user
94 * @param bool $isDaylight -
95 * @param integer $style -
96 * @param string $locale -
98 * @return string -
100 <<__Native>>
101 public function getDisplayName(bool $isDaylight = false,
102 int $style = IntlTimeZone::DISPLAY_LONG,
103 string $locale = ""): mixed;
106 * Get the amount of time to be added to local standard time to get local
107 * wall clock time
109 * @return integer -
111 <<__Native>>
112 public function getDSTSavings(): int;
115 * Get an ID in the equivalency group that includes the given ID
117 * @param string $zoneId -
118 * @param integer $index -
120 * @return string -
122 <<__Native>>
123 public static function getEquivalentID(string $zoneId,
124 int $index): mixed;
127 * Get last error code on the object
129 * @return integer -
131 <<__Native>>
132 public function getErrorCode(): int;
135 * Get last error message on the object
137 * @return string -
139 <<__Native>>
140 public function getErrorMessage(): string;
143 * Create GMT (UTC) timezone
145 * @return IntlTimeZone -
147 <<__Native>>
148 public static function getGMT(): IntlTimeZone;
150 <<__Native>>
151 public static function getUnknown(): IntlTimeZone;
154 * Get timezone ID
156 * @return string -
158 <<__Native>>
159 public function getID(): mixed;
162 * Get the time zone raw and GMT offset for the given moment in time
164 * @param float $date -
165 * @param bool $local -
166 * @param integer $rawOffset -
167 * @param integer $dstOffset -
169 * @return integer -
171 <<__Native>>
172 public function getOffset(float $date,
173 bool $local,
174 int &$rawOffset,
175 int &$dstOffset): bool;
178 * Get the raw GMT offset (before taking daylight savings time into
179 * account
181 * @return integer -
183 <<__Native>>
184 public function getRawOffset(): mixed;
187 * Get the timezone data version currently used by ICU
189 * @return string -
191 <<__Native>>
192 public static function getTZDataVersion(): mixed;
195 * Check if this zone has the same rules and offset as another zone
197 * @param IntlTimeZone $otherTimeZone -
199 * @return bool -
201 <<__Native>>
202 public function hasSameRules(IntlTimeZone $otherTimeZone): bool;
205 * Convert to object
207 * @return DateTimeZone -
209 public function toDateTimeZone(): DateTimeZone {
210 $id = $this->getID();
211 if (!strncmp($id, "GMT", 3)) {
212 throw new Exception("Converting IntlTimeZone to DateTimeZone ".
213 "is not currently supported for GMT offsets");
215 return new DateTimeZone($id);
219 * Check if this time zone uses daylight savings time
221 * @return bool -
223 <<__Native>>
224 public function useDaylightTime(): bool;
228 * Get the number of IDs in the equivalency group that includes the given
229 * ID
231 * @param string $zoneId -
233 * @return integer -
235 function intltz_count_equivalent_ids(string $zoneId): mixed {
236 return IntlTimeZone::countEquivalentIDs($zoneId);
239 function intltz_create_time_zone_id_enumeration(
240 int $zonetype,
241 string $region = "",
242 ?int $offset = null): mixed {
243 return IntlTimeZone::createTimeZoneIDEnumeration($zonetype,
244 $region, $offset);
248 * Create a new copy of the default timezone for this host
250 * @return IntlTimeZone -
252 function intltz_create_default(): IntlTimeZone {
253 return IntlTimeZone::createDefault();
257 * Get an enumeration over time zone IDs associated with the
258 * given country or offset
260 * @param mixed $countryOrRawOffset -
262 * @return IntlIterator -
264 function intltz_create_enumeration(mixed $countryOrRawOffset = null): mixed {
265 return IntlTimeZone::createEnumeration($countryOrRawOffset);
269 * Create a timezone object for the given ID
271 * @param string $zoneId -
273 * @return IntlTimeZone -
275 function intltz_create_time_zone(string $zoneId): IntlTimeZone {
276 return IntlTimeZone::createTimeZone($zoneId);
280 * Create a timezone object from
282 * @param DateTimeZone $zoneId -
284 * @return IntlTimeZone -
286 function intltz_from_date_time_zone(DateTimeZone $zoneId): IntlTimeZone {
287 return IntlTimeZone::fromDateTimeZone($zoneId);
291 * Get the canonical system timezone ID or the normalized custom time zone
292 * ID for the given time zone ID
294 * @param string $zoneId -
295 * @param bool $isSystemID -
297 * @return string -
299 function intltz_get_canonical_id(string $zoneId,
300 mixed &$isSystemID = null): mixed {
301 return IntlTimeZone::getCanonicalID($zoneId, $isSystemID);
304 function intltz_get_region(string $str): mixed {
305 return IntlTimeZone::getRegion($str);
309 * Get a name of this time zone suitable for presentation to the user
311 * @param bool $isDaylight -
312 * @param integer $style -
313 * @param string $locale -
315 * @return string -
317 function intltz_get_display_name(IntlTimeZone $obj,
318 bool $isDaylight = false,
319 int $style = IntlTimeZone::DISPLAY_LONG,
320 string $locale = ""): mixed {
321 return $obj->getDisplayName($isDaylight, $style, $locale);
325 * Get the amount of time to be added to local standard time to get local
326 * wall clock time
328 * @return integer -
330 function intltz_get_dst_savings(IntlTimeZone $obj): int {
331 return $obj->getDSTSavings();
335 * Get an ID in the equivalency group that includes the given ID
337 * @param string $zoneId -
338 * @param integer $index -
340 * @return string -
342 function intltz_get_equivalent_id(string $zoneId,
343 int $index): mixed {
344 return IntlTimeZone::getEquivalentID($zoneId, $index);
348 * Get last error code on the object
350 * @return integer -
352 function intltz_get_error_code(IntlTimeZone $obj): int {
353 return $obj->getErrorCode();
357 * Get last error message on the object
359 * @return string -
361 function intltz_get_error_message(IntlTimeZone $obj): string {
362 return $obj->getErrorMessage();
366 * Create GMT (UTC) timezone
368 * @return IntlTimeZone -
370 function intltz_get_gmt(): IntlTimeZone {
371 return IntlTimeZone::getGMT();
374 function intltz_get_unknown(): IntlTimeZone {
375 return IntlTimeZone::getUnknown();
379 * Get timezone ID
381 * @return string -
383 function intltz_get_id(IntlTimeZone $obj): string {
384 return $obj->getID();
388 * Get the time zone raw and GMT offset for the given moment in time
390 * @param float $date -
391 * @param bool $local -
392 * @param integer $rawOffset -
393 * @param integer $dstOffset -
395 * @return integer -
397 function intltz_get_offset(IntlTimeZone $obj,
398 float $date,
399 bool $local,
400 int &$rawOffset,
401 int &$dstOffset): bool {
402 return $obj->getOffset($date, $local, $rawOffset, $dstOffset);
406 * Get the raw GMT offset (before taking daylight savings time into
407 * account
409 * @return integer -
411 function intltz_get_raw_offset(IntlTimeZone $obj): mixed {
412 return $obj->getRawOffset();
416 * Get the timezone data version currently used by ICU
418 * @return string -
420 function intltz_get_tz_data_version(): mixed {
421 return IntlTimeZone::getTZDataVersion();
425 * Check if this zone has the same rules and offset as another zone
427 * @param IntlTimeZone $otherTimeZone -
429 * @return bool -
431 function intltz_has_same_rules(IntlTimeZone $obj,
432 IntlTimeZone $otherTimeZone): bool {
433 return $obj->hasSameRules($otherTimeZone);
437 * Convert to object
439 * @return DateTimeZone -
441 function intltz_to_date_time_zone(IntlTimeZone $obj): DateTimeZone {
442 return $obj->toDateTimeZone();
446 * Check if this time zone uses daylight savings time
448 * @return bool -
450 function intltz_use_daylight_time(IntlTimeZone $obj): bool {
451 return $obj->useDaylightTime();