PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/intl/timezone - timezone_class.cpp (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 0 183 0.0 %
Date: 2014-04-16 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 5                                                        |
       4             :    +----------------------------------------------------------------------+
       5             :    | This source file is subject to version 3.01 of the PHP license,      |
       6             :    | that is bundled with this package in the file LICENSE, and is        |
       7             :    | available through the world-wide-web at the following url:           |
       8             :    | http://www.php.net/license/3_01.txt                                  |
       9             :    | If you did not receive a copy of the PHP license and are unable to   |
      10             :    | obtain it through the world-wide-web, please send a note to          |
      11             :    | license@php.net so we can mail you a copy immediately.               |
      12             :    +----------------------------------------------------------------------+
      13             :    | Authors: Gustavo Lopes <cataphract@php.net>                          |
      14             :    +----------------------------------------------------------------------+
      15             : */
      16             : 
      17             : 
      18             : #ifdef HAVE_CONFIG_H
      19             : #include "config.h"
      20             : #endif
      21             : 
      22             : #include "../intl_cppshims.h"
      23             : 
      24             : #include <unicode/timezone.h>
      25             : #include <unicode/calendar.h>
      26             : #include "../intl_convertcpp.h"
      27             : 
      28             : #include "../common/common_date.h"
      29             : 
      30             : extern "C" {
      31             : #include "../intl_convert.h"
      32             : #define USE_TIMEZONE_POINTER 1
      33             : #include "timezone_class.h"
      34             : #include "timezone_methods.h"
      35             : #include <zend_exceptions.h>
      36             : #include <zend_interfaces.h>
      37             : #include <ext/date/php_date.h>
      38             : }
      39             : 
      40             : /* {{{ Global variables */
      41             : U_CDECL_BEGIN
      42             : zend_class_entry *TimeZone_ce_ptr = NULL;
      43             : zend_object_handlers TimeZone_handlers;
      44             : U_CDECL_END
      45             : /* }}} */
      46             : 
      47             : /* {{{ timezone_object_construct */
      48           0 : U_CFUNC void timezone_object_construct(const TimeZone *zone, zval *object, int owned TSRMLS_DC)
      49             : {
      50             :         TimeZone_object *to;
      51             : 
      52           0 :         object_init_ex(object, TimeZone_ce_ptr);
      53           0 :         TIMEZONE_METHOD_FETCH_OBJECT_NO_CHECK; /* fetch zend object from zval "object" into "to" */
      54           0 :         to->utimezone = zone;
      55           0 :         to->should_delete = owned;
      56           0 : }
      57             : /* }}} */
      58             : 
      59             : /* {{{ timezone_convert_to_datetimezone
      60             :  *         Convert from TimeZone to DateTimeZone object */
      61           0 : U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone,
      62             :                                                                                            intl_error *outside_error,
      63             :                                                                                            const char *func TSRMLS_DC)
      64             : {
      65           0 :         zval                            *ret = NULL;
      66           0 :         UnicodeString           id;
      67           0 :         char                            *message = NULL;
      68             :         php_timezone_obj        *tzobj;
      69           0 :         zval                            arg = zval_used_for_init;
      70             : 
      71           0 :         timeZone->getID(id);
      72           0 :         if (id.isBogus()) {
      73           0 :                 spprintf(&message, 0, "%s: could not obtain TimeZone id", func);
      74             :                 intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR,
      75           0 :                         message, 1 TSRMLS_CC);
      76           0 :                 goto error;
      77             :         }
      78             : 
      79           0 :         MAKE_STD_ZVAL(ret);
      80           0 :         object_init_ex(ret, php_date_get_timezone_ce());
      81           0 :         tzobj = (php_timezone_obj *)zend_objects_get_address(ret TSRMLS_CC);
      82             : 
      83           0 :         if (id.compare(0, 3, UnicodeString("GMT", sizeof("GMT")-1, US_INV)) == 0) {
      84             :                 /* The DateTimeZone constructor doesn't support offset time zones,
      85             :                  * so we must mess with DateTimeZone structure ourselves */
      86           0 :                 tzobj->initialized     = 1;
      87           0 :                 tzobj->type                    = TIMELIB_ZONETYPE_OFFSET;
      88             :                 //convert offset from milliseconds to minutes
      89           0 :                 tzobj->tzi.utc_offset = -1 * timeZone->getRawOffset() / (60 * 1000);
      90             :         } else {
      91             :                 /* Call the constructor! */
      92           0 :                 Z_TYPE(arg) = IS_STRING;
      93           0 :                 if (intl_charFromString(id, &Z_STRVAL(arg), &Z_STRLEN(arg),
      94             :                                 &INTL_ERROR_CODE(*outside_error)) == FAILURE) {
      95           0 :                         spprintf(&message, 0, "%s: could not convert id to UTF-8", func);
      96             :                         intl_errors_set(outside_error, INTL_ERROR_CODE(*outside_error),
      97           0 :                                 message, 1 TSRMLS_CC);
      98           0 :                         goto error;
      99             :                 }
     100             :                 zend_call_method_with_1_params(&ret, NULL, NULL, "__construct",
     101           0 :                         NULL, &arg);
     102           0 :                 if (EG(exception)) {
     103             :                         spprintf(&message, 0,
     104           0 :                                 "%s: DateTimeZone constructor threw exception", func);
     105             :                         intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR,
     106           0 :                                 message, 1 TSRMLS_CC);
     107           0 :                         zend_object_store_ctor_failed(ret TSRMLS_CC);
     108           0 :                         goto error;
     109             :                 }
     110             :         }
     111             : 
     112           0 :         if (0) {
     113             : error:
     114           0 :                 if (ret) {
     115           0 :                         zval_ptr_dtor(&ret);
     116             :                 }
     117           0 :                 ret = NULL;
     118             :         }
     119             : 
     120           0 :         if (message) {
     121           0 :                 efree(message);
     122             :         }
     123           0 :         if (Z_TYPE(arg) == IS_STRING) {
     124             :                 zval_dtor(&arg);
     125             :         }
     126           0 :         return ret;
     127             : }
     128             : /* }}} */
     129             : 
     130             : /* {{{ timezone_process_timezone_argument
     131             :  * TimeZone argument processor. outside_error may be NULL (for static functions/constructors) */
     132           0 : U_CFUNC TimeZone *timezone_process_timezone_argument(zval **zv_timezone,
     133             :                                                                                                          intl_error *outside_error,
     134             :                                                                                                          const char *func TSRMLS_DC)
     135             : {
     136           0 :         zval            local_zv_tz             = zval_used_for_init,
     137           0 :                                 *local_zv_tz_p  = &local_zv_tz;
     138           0 :         char            *message = NULL;
     139             :         TimeZone        *timeZone;
     140             : 
     141           0 :         if (zv_timezone == NULL || Z_TYPE_PP(zv_timezone) == IS_NULL) {
     142           0 :                 timelib_tzinfo *tzinfo = get_timezone_info(TSRMLS_C);
     143           0 :                 ZVAL_STRING(&local_zv_tz, tzinfo->name, 0);
     144           0 :                 zv_timezone = &local_zv_tz_p;
     145             :         }
     146             : 
     147           0 :         if (Z_TYPE_PP(zv_timezone) == IS_OBJECT &&
     148             :                         instanceof_function(Z_OBJCE_PP(zv_timezone), TimeZone_ce_ptr TSRMLS_CC)) {
     149             :                 TimeZone_object *to = (TimeZone_object*)zend_objects_get_address(
     150           0 :                         *zv_timezone TSRMLS_CC);
     151           0 :                 if (to->utimezone == NULL) {
     152             :                         spprintf(&message, 0, "%s: passed IntlTimeZone is not "
     153           0 :                                 "properly constructed", func);
     154           0 :                         if (message) {
     155           0 :                                 intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC);
     156           0 :                                 efree(message);
     157             :                         }
     158           0 :                         return NULL;
     159             :                 }
     160           0 :                 timeZone = to->utimezone->clone();
     161           0 :                 if (timeZone == NULL) {
     162           0 :                         spprintf(&message, 0, "%s: could not clone TimeZone", func);
     163           0 :                         if (message) {
     164           0 :                                 intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1 TSRMLS_CC);
     165           0 :                                 efree(message);
     166             :                         }
     167           0 :                         return NULL;
     168             :                 }
     169           0 :         } else if (Z_TYPE_PP(zv_timezone) == IS_OBJECT &&
     170             :                         instanceof_function(Z_OBJCE_PP(zv_timezone), php_date_get_timezone_ce() TSRMLS_CC)) {
     171             : 
     172             :                 php_timezone_obj *tzobj = (php_timezone_obj *)zend_objects_get_address(
     173           0 :                                 *zv_timezone TSRMLS_CC);
     174             : 
     175             :                 return timezone_convert_datetimezone(tzobj->type, tzobj, 0,
     176           0 :                         outside_error, func TSRMLS_CC);
     177             :         } else {
     178           0 :                 UnicodeString   id,
     179           0 :                                                 gottenId;
     180           0 :                 UErrorCode              status = U_ZERO_ERROR; /* outside_error may be NULL */
     181           0 :                 convert_to_string_ex(zv_timezone);
     182           0 :                 if (intl_stringFromChar(id, Z_STRVAL_PP(zv_timezone), Z_STRLEN_PP(zv_timezone),
     183             :                                 &status) == FAILURE) {
     184             :                         spprintf(&message, 0, "%s: Time zone identifier given is not a "
     185           0 :                                 "valid UTF-8 string", func);
     186           0 :                         if (message) {
     187           0 :                                 intl_errors_set(outside_error, status, message, 1 TSRMLS_CC);
     188           0 :                                 efree(message);
     189             :                         }
     190           0 :                         return NULL;
     191             :                 }
     192           0 :                 timeZone = TimeZone::createTimeZone(id);
     193           0 :                 if (timeZone == NULL) {
     194           0 :                         spprintf(&message, 0, "%s: could not create time zone", func);
     195           0 :                         if (message) {
     196           0 :                                 intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1 TSRMLS_CC);
     197           0 :                                 efree(message);
     198             :                         }
     199           0 :                         return NULL;
     200             :                 }
     201           0 :                 if (timeZone->getID(gottenId) != id) {
     202             :                         spprintf(&message, 0, "%s: no such time zone: '%s'",
     203           0 :                                 func, Z_STRVAL_PP(zv_timezone));
     204           0 :                         if (message) {
     205           0 :                                 intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1 TSRMLS_CC);
     206           0 :                                 efree(message);
     207             :                         }
     208           0 :                         delete timeZone;
     209           0 :                         return NULL;
     210           0 :                 }
     211             :         }
     212             : 
     213           0 :         return timeZone;
     214             : }
     215             : /* }}} */
     216             : 
     217             : /* {{{ clone handler for TimeZone */
     218           0 : static zend_object_value TimeZone_clone_obj(zval *object TSRMLS_DC)
     219             : {
     220             :         TimeZone_object         *to_orig,
     221             :                                                 *to_new;
     222             :         zend_object_value   ret_val;
     223           0 :         intl_error_reset(NULL TSRMLS_CC);
     224             : 
     225           0 :         to_orig = (TimeZone_object*)zend_object_store_get_object(object TSRMLS_CC);
     226           0 :         intl_error_reset(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC);
     227             : 
     228           0 :         ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
     229             :         to_new  = (TimeZone_object*)zend_object_store_get_object_by_handle(
     230           0 :                 ret_val.handle TSRMLS_CC);
     231             : 
     232             :         zend_objects_clone_members(&to_new->zo, ret_val,
     233           0 :                 &to_orig->zo, Z_OBJ_HANDLE_P(object) TSRMLS_CC);
     234             : 
     235           0 :         if (to_orig->utimezone != NULL) {
     236             :                 TimeZone        *newTimeZone;
     237             : 
     238           0 :                 newTimeZone = to_orig->utimezone->clone();
     239           0 :                 to_new->should_delete = 1;
     240           0 :                 if (!newTimeZone) {
     241             :                         char *err_msg;
     242             :                         intl_errors_set_code(TIMEZONE_ERROR_P(to_orig),
     243           0 :                                 U_MEMORY_ALLOCATION_ERROR TSRMLS_CC);
     244             :                         intl_errors_set_custom_msg(TIMEZONE_ERROR_P(to_orig),
     245           0 :                                 "Could not clone IntlTimeZone", 0 TSRMLS_CC);
     246           0 :                         err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig) TSRMLS_CC);
     247           0 :                         zend_throw_exception(NULL, err_msg, 0 TSRMLS_CC);
     248           0 :                         efree(err_msg);
     249             :                 } else {
     250           0 :                         to_new->utimezone = newTimeZone;
     251             :                 }
     252             :         } else {
     253           0 :                 zend_throw_exception(NULL, "Cannot clone unconstructed IntlTimeZone", 0 TSRMLS_CC);
     254             :         }
     255             : 
     256           0 :         return ret_val;
     257             : }
     258             : /* }}} */
     259             : 
     260             : /* {{{ compare_objects handler for TimeZone
     261             :  *     Can't be used for >, >=, <, <= comparisons */
     262           0 : static int TimeZone_compare_objects(zval *object1, zval *object2 TSRMLS_DC)
     263             : {
     264             :         TimeZone_object         *to1,
     265             :                                                 *to2;
     266           0 :         to1 = (TimeZone_object*)zend_object_store_get_object(object1 TSRMLS_CC);
     267           0 :         to2 = (TimeZone_object*)zend_object_store_get_object(object2 TSRMLS_CC);
     268             : 
     269           0 :         if (to1->utimezone == NULL || to2->utimezone == NULL) {
     270             :                 zend_throw_exception(NULL, "Comparison with at least one unconstructed "
     271           0 :                                 "IntlTimeZone operand", 0 TSRMLS_CC);
     272             :                 /* intentionally not returning */
     273             :         } else {
     274           0 :                 if (*to1->utimezone == *to2->utimezone) {
     275           0 :                         return 0;
     276             :                 }
     277             :         }
     278             :         
     279           0 :         return 1;
     280             : }
     281             : /* }}} */
     282             : 
     283             : /* {{{ get_debug_info handler for TimeZone */
     284           0 : static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
     285             : {
     286           0 :         zval                    zv = zval_used_for_init;
     287             :         TimeZone_object *to;
     288             :         const TimeZone  *tz;
     289           0 :         UnicodeString   ustr;
     290             :         char                    *str;
     291             :         int                             str_len;
     292           0 :         UErrorCode              uec = U_ZERO_ERROR;
     293             : 
     294           0 :         *is_temp = 1;
     295             :         
     296           0 :         array_init_size(&zv, 4);
     297             : 
     298           0 :         to = (TimeZone_object*)zend_object_store_get_object(object TSRMLS_CC);
     299           0 :         tz = to->utimezone;
     300             : 
     301           0 :         if (tz == NULL) {
     302           0 :                 add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 0);
     303           0 :                 return Z_ARRVAL(zv);
     304             :         }
     305             : 
     306           0 :         add_assoc_bool_ex(&zv, "valid", sizeof("valid"), 1);
     307             : 
     308           0 :         tz->getID(ustr);
     309             :         intl_convert_utf16_to_utf8(&str, &str_len,
     310           0 :                 ustr.getBuffer(), ustr.length(), &uec);
     311           0 :         if (U_FAILURE(uec)) {
     312           0 :                 return Z_ARRVAL(zv);
     313             :         }
     314           0 :         add_assoc_stringl_ex(&zv, "id", sizeof("id"), str, str_len, 0);
     315             : 
     316             :         int32_t rawOffset, dstOffset;
     317           0 :         UDate now = Calendar::getNow();
     318           0 :         tz->getOffset(now, FALSE, rawOffset, dstOffset, uec);
     319           0 :         if (U_FAILURE(uec)) {
     320           0 :                 return Z_ARRVAL(zv);
     321             :         }
     322             :         
     323           0 :         add_assoc_long_ex(&zv, "rawOffset", sizeof("rawOffset"), (long)rawOffset);
     324             :         add_assoc_long_ex(&zv, "currentOffset", sizeof("currentOffset"),
     325           0 :                 (long)(rawOffset + dstOffset));
     326             : 
     327           0 :         return Z_ARRVAL(zv);
     328             : }
     329             : /* }}} */
     330             : 
     331             : /* {{{ void TimeZone_object_init(TimeZone_object* to)
     332             :  * Initialize internals of TImeZone_object not specific to zend standard objects.
     333             :  */
     334           0 : static void TimeZone_object_init(TimeZone_object *to TSRMLS_DC)
     335             : {
     336           0 :         intl_error_init(TIMEZONE_ERROR_P(to) TSRMLS_CC);
     337           0 :         to->utimezone = NULL;
     338           0 :         to->should_delete = 0;
     339           0 : }
     340             : /* }}} */
     341             : 
     342             : /* {{{ TimeZone_objects_dtor */
     343           0 : static void TimeZone_objects_dtor(zend_object *object,
     344             :                                                                    zend_object_handle handle TSRMLS_DC)
     345             : {
     346           0 :         zend_objects_destroy_object(object, handle TSRMLS_CC);
     347           0 : }
     348             : /* }}} */
     349             : 
     350             : /* {{{ TimeZone_objects_free */
     351           0 : static void TimeZone_objects_free(zend_object *object TSRMLS_DC)
     352             : {
     353           0 :         TimeZone_object* to = (TimeZone_object*) object;
     354             : 
     355           0 :         if (to->utimezone && to->should_delete) {
     356           0 :                 delete to->utimezone;
     357           0 :                 to->utimezone = NULL;
     358             :         }
     359           0 :         intl_error_reset(TIMEZONE_ERROR_P(to) TSRMLS_CC);
     360             : 
     361           0 :         zend_object_std_dtor(&to->zo TSRMLS_CC);
     362             : 
     363           0 :         efree(to);
     364           0 : }
     365             : /* }}} */
     366             : 
     367             : /* {{{ TimeZone_object_create */
     368           0 : static zend_object_value TimeZone_object_create(zend_class_entry *ce TSRMLS_DC)
     369             : {
     370             :         zend_object_value   retval;
     371             :         TimeZone_object*        intern;
     372             : 
     373           0 :         intern = (TimeZone_object*)ecalloc(1, sizeof(TimeZone_object));
     374             :         
     375           0 :         zend_object_std_init(&intern->zo, ce TSRMLS_CC);
     376             : #if PHP_VERSION_ID < 50399
     377             :     zend_hash_copy(intern->zo.properties, &(ce->default_properties),
     378             :         (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
     379             : #else
     380           0 :     object_properties_init((zend_object*) intern, ce);
     381             : #endif
     382           0 :         TimeZone_object_init(intern TSRMLS_CC);
     383             : 
     384             :         retval.handle = zend_objects_store_put(
     385             :                 intern,
     386             :                 (zend_objects_store_dtor_t) TimeZone_objects_dtor,
     387             :                 (zend_objects_free_object_storage_t) TimeZone_objects_free,
     388           0 :                 NULL TSRMLS_CC);
     389             : 
     390           0 :         retval.handlers = &TimeZone_handlers;
     391             : 
     392           0 :         return retval;
     393             : }
     394             : /* }}} */
     395             : 
     396             : /* {{{ TimeZone methods arguments info */
     397             : 
     398             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_idarg, 0, 0, 1)
     399             :         ZEND_ARG_INFO(0, zoneId)
     400             : ZEND_END_ARG_INFO()
     401             : 
     402             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_fromDateTimeZone, 0, 0, 1)
     403             :         ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
     404             : ZEND_END_ARG_INFO()
     405             : 
     406             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_createEnumeration, 0, 0, 0)
     407             :         ZEND_ARG_INFO(0, countryOrRawOffset)
     408             : ZEND_END_ARG_INFO()
     409             : 
     410             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_countEquivalentIDs, 0, 0, 1)
     411             :         ZEND_ARG_INFO(0, zoneId)
     412             : ZEND_END_ARG_INFO()
     413             : 
     414             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_createTimeZoneIDEnumeration, 0, 0, 1)
     415             :         ZEND_ARG_INFO(0, zoneType)
     416             :         ZEND_ARG_INFO(0, region)
     417             :         ZEND_ARG_INFO(0, rawOffset)
     418             : ZEND_END_ARG_INFO()
     419             : 
     420             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getCanonicalID, 0, 0, 1)
     421             :         ZEND_ARG_INFO(0, zoneId)
     422             :         ZEND_ARG_INFO(1, isSystemID)
     423             : ZEND_END_ARG_INFO()
     424             : 
     425             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getEquivalentID, 0, 0, 2)
     426             :         ZEND_ARG_INFO(0, zoneId)
     427             :         ZEND_ARG_INFO(0, index)
     428             : ZEND_END_ARG_INFO()
     429             : 
     430             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getOffset, 0, 0, 4)
     431             :         ZEND_ARG_INFO(0, date)
     432             :         ZEND_ARG_INFO(0, local)
     433             :         ZEND_ARG_INFO(1, rawOffset)
     434             :         ZEND_ARG_INFO(1, dstOffset)
     435             : ZEND_END_ARG_INFO()
     436             : 
     437             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_hasSameRules, 0, 0, 1)
     438             :         ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
     439             : ZEND_END_ARG_INFO()
     440             : 
     441             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getDisplayName, 0, 0, 0)
     442             :         ZEND_ARG_INFO(0, isDaylight)
     443             :         ZEND_ARG_INFO(0, style)
     444             :         ZEND_ARG_INFO(0, locale)
     445             : ZEND_END_ARG_INFO()
     446             : 
     447             : ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_void, 0, 0, 0)
     448             : ZEND_END_ARG_INFO()
     449             : 
     450             : /* }}} */
     451             : 
     452             : /* {{{ TimeZone_class_functions
     453             :  * Every 'IntlTimeZone' class method has an entry in this table
     454             :  */
     455             : static zend_function_entry TimeZone_class_functions[] = {
     456             :         PHP_ME(IntlTimeZone,                            __construct,                                    ainfo_tz_void,                          ZEND_ACC_PRIVATE)
     457             :         PHP_ME_MAPPING(createTimeZone,          intltz_create_time_zone,                ainfo_tz_idarg,                         ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     458             :         PHP_ME_MAPPING(fromDateTimeZone,        intltz_from_date_time_zone,             ainfo_tz_idarg,                         ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     459             :         PHP_ME_MAPPING(createDefault,           intltz_create_default,                  ainfo_tz_void,                          ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     460             :         PHP_ME_MAPPING(getGMT,                          intltz_get_gmt,                                 ainfo_tz_void,                          ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     461             : #if U_ICU_VERSION_MAJOR_NUM >= 49
     462             :         PHP_ME_MAPPING(getUnknown,                      intltz_get_unknown,                             ainfo_tz_void,                          ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     463             : #endif
     464             :         PHP_ME_MAPPING(createEnumeration,       intltz_create_enumeration,              ainfo_tz_createEnumeration,     ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     465             :         PHP_ME_MAPPING(countEquivalentIDs,      intltz_count_equivalent_ids,    ainfo_tz_idarg,                         ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     466             : #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
     467             :         PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, ainfo_tz_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     468             : #endif
     469             :         PHP_ME_MAPPING(getCanonicalID,          intltz_get_canonical_id,                ainfo_tz_getCanonicalID,        ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     470             : #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
     471             :         PHP_ME_MAPPING(getRegion,                       intltz_get_region,                              ainfo_tz_idarg,                         ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     472             : #endif
     473             :         PHP_ME_MAPPING(getTZDataVersion,        intltz_get_tz_data_version,             ainfo_tz_void,                          ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     474             :         PHP_ME_MAPPING(getEquivalentID,         intltz_get_equivalent_id,               ainfo_tz_getEquivalentID,       ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
     475             : 
     476             :         PHP_ME_MAPPING(getID,                           intltz_get_id,                                  ainfo_tz_void,                          ZEND_ACC_PUBLIC)
     477             :         PHP_ME_MAPPING(useDaylightTime,         intltz_use_daylight_time,               ainfo_tz_void,                          ZEND_ACC_PUBLIC)
     478             :         PHP_ME_MAPPING(getOffset,                       intltz_get_offset,                              ainfo_tz_getOffset,                     ZEND_ACC_PUBLIC)
     479             :         PHP_ME_MAPPING(getRawOffset,            intltz_get_raw_offset,                  ainfo_tz_void,                          ZEND_ACC_PUBLIC)
     480             :         PHP_ME_MAPPING(hasSameRules,            intltz_has_same_rules,                  ainfo_tz_hasSameRules,          ZEND_ACC_PUBLIC)
     481             :         PHP_ME_MAPPING(getDisplayName,          intltz_get_display_name,                ainfo_tz_getDisplayName,        ZEND_ACC_PUBLIC)
     482             :         PHP_ME_MAPPING(getDSTSavings,           intltz_get_dst_savings,                 ainfo_tz_void,                          ZEND_ACC_PUBLIC)
     483             :         PHP_ME_MAPPING(toDateTimeZone,          intltz_to_date_time_zone,               ainfo_tz_void,                          ZEND_ACC_PUBLIC)
     484             :         PHP_ME_MAPPING(getErrorCode,            intltz_get_error_code,                  ainfo_tz_void,                          ZEND_ACC_PUBLIC)
     485             :         PHP_ME_MAPPING(getErrorMessage,         intltz_get_error_message,               ainfo_tz_void,                          ZEND_ACC_PUBLIC)
     486             :         PHP_FE_END
     487             : };
     488             : /* }}} */
     489             : 
     490             : /* {{{ timezone_register_IntlTimeZone_class
     491             :  * Initialize 'IntlTimeZone' class
     492             :  */
     493           0 : U_CFUNC void timezone_register_IntlTimeZone_class(TSRMLS_D)
     494             : {
     495             :         zend_class_entry ce;
     496             : 
     497             :         /* Create and register 'IntlTimeZone' class. */
     498           0 :         INIT_CLASS_ENTRY(ce, "IntlTimeZone", TimeZone_class_functions);
     499           0 :         ce.create_object = TimeZone_object_create;
     500           0 :         TimeZone_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC);
     501           0 :         if (!TimeZone_ce_ptr) {
     502             :                 //can't happen now without bigger problems before
     503             :                 php_error_docref0(NULL TSRMLS_CC, E_ERROR,
     504           0 :                         "IntlTimeZone: class registration has failed.");
     505           0 :                 return;
     506             :         }
     507             : 
     508             :         memcpy(&TimeZone_handlers, zend_get_std_object_handlers(),
     509           0 :                 sizeof TimeZone_handlers);
     510           0 :         TimeZone_handlers.clone_obj = TimeZone_clone_obj;
     511           0 :         TimeZone_handlers.compare_objects = TimeZone_compare_objects;
     512           0 :         TimeZone_handlers.get_debug_info = TimeZone_get_debug_info;
     513             : 
     514             :         /* Declare 'IntlTimeZone' class constants */
     515             : #define TIMEZONE_DECL_LONG_CONST(name, val) \
     516             :         zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \
     517             :                 val TSRMLS_CC)
     518             : 
     519           0 :         TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT);
     520           0 :         TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG);
     521             : 
     522             : #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44
     523             :         TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC);
     524             :         TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC);
     525             :         TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT);
     526             :         TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT);
     527             :         TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED);
     528             :         TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION);
     529             : #endif
     530             : 
     531             : #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48
     532             :         TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY);
     533             :         TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL);
     534             :         TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION);
     535             : #endif
     536             : 
     537             :         /* Declare 'IntlTimeZone' class properties */
     538             : 
     539             : }
     540             : /* }}} */

Generated by: LCOV version 1.10

Generated at Wed, 16 Apr 2014 12:47:49 +0000 (3 hours ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.