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/formatter - formatter_attr.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 134 158 84.8 %
Date: 2014-10-22 Functions: 9 9 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 7                                                        |
       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: Stanislav Malyshev <stas@zend.com>                          |
      14             :    +----------------------------------------------------------------------+
      15             :  */
      16             : 
      17             : #ifdef HAVE_CONFIG_H
      18             : #include "config.h"
      19             : #endif
      20             : 
      21             : #include "php_intl.h"
      22             : #include "formatter_class.h"
      23             : #include "formatter_attr.h"
      24             : #include "intl_convert.h"
      25             : 
      26             : #include <unicode/ustring.h>
      27             : 
      28             : /* {{{ proto mixed NumberFormatter::getAttribute( int $attr )
      29             :  * Get formatter attribute value. }}} */
      30             : /* {{{ proto mixed numfmt_get_attribute( NumberFormatter $nf, int $attr )
      31             :  * Get formatter attribute value.
      32             :  */
      33           1 : PHP_FUNCTION( numfmt_get_attribute )
      34             : {
      35             :         zend_long attribute, value;
      36           1 :         FORMATTER_METHOD_INIT_VARS;
      37             : 
      38             :         /* Parse parameters. */
      39           1 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
      40             :                 &object, NumberFormatter_ce_ptr, &attribute ) == FAILURE )
      41             :         {
      42           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      43             :                         "numfmt_get_attribute: unable to parse input params", 0 TSRMLS_CC );
      44             : 
      45           1 :                 RETURN_FALSE;
      46             :         }
      47             : 
      48             :         /* Fetch the object. */
      49           0 :         FORMATTER_METHOD_FETCH_OBJECT;
      50             : 
      51           0 :         switch(attribute) {
      52             :                 case UNUM_PARSE_INT_ONLY:
      53             :                 case UNUM_GROUPING_USED:
      54             :                 case UNUM_DECIMAL_ALWAYS_SHOWN:
      55             :                 case UNUM_MAX_INTEGER_DIGITS:
      56             :                 case UNUM_MIN_INTEGER_DIGITS:
      57             :                 case UNUM_INTEGER_DIGITS:
      58             :                 case UNUM_MAX_FRACTION_DIGITS:
      59             :                 case UNUM_MIN_FRACTION_DIGITS:
      60             :                 case UNUM_FRACTION_DIGITS:
      61             :                 case UNUM_MULTIPLIER:
      62             :                 case UNUM_GROUPING_SIZE:
      63             :                 case UNUM_ROUNDING_MODE:
      64             :                 case UNUM_FORMAT_WIDTH:
      65             :                 case UNUM_PADDING_POSITION:
      66             :                 case UNUM_SECONDARY_GROUPING_SIZE:
      67             :                 case UNUM_SIGNIFICANT_DIGITS_USED:
      68             :                 case UNUM_MIN_SIGNIFICANT_DIGITS:
      69             :                 case UNUM_MAX_SIGNIFICANT_DIGITS:
      70             :                 case UNUM_LENIENT_PARSE:
      71           0 :                         value = unum_getAttribute(FORMATTER_OBJECT(nfo), attribute);
      72           0 :                         if(value == -1) {
      73           0 :                                 INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
      74             :                         } else {
      75           0 :                                 RETVAL_LONG(value);
      76             :                         }
      77           0 :                         break;
      78             :                 case UNUM_ROUNDING_INCREMENT:
      79             :                 {
      80           0 :                         double value_double = unum_getDoubleAttribute(FORMATTER_OBJECT(nfo), attribute);
      81           0 :                         if(value_double == -1) {
      82           0 :                                 INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
      83             :                         } else {
      84           0 :                                 RETVAL_DOUBLE(value_double);
      85             :                         }
      86             :                 }
      87           0 :                         break;
      88             :                 default:
      89           0 :                         INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
      90             :                         break;
      91             :         }
      92             : 
      93           0 :         INTL_METHOD_CHECK_STATUS( nfo, "Error getting attribute value" );
      94             : }
      95             : /* }}} */
      96             : 
      97             : /* {{{ proto string NumberFormatter::getTextAttribute( int $attr )
      98             :  * Get formatter attribute value. }}} */
      99             : /* {{{ proto string numfmt_get_text_attribute( NumberFormatter $nf, int $attr )
     100             :  * Get formatter attribute value.
     101             :  */
     102          27 : PHP_FUNCTION( numfmt_get_text_attribute )
     103             : {
     104             :         zend_long   attribute;
     105             :         UChar  value_buf[64];
     106          27 :         int    value_buf_size = USIZE( value_buf );
     107          27 :         UChar* value  = value_buf;
     108          27 :         int    length = 0;
     109          27 :         FORMATTER_METHOD_INIT_VARS;
     110             : 
     111             :         /* Parse parameters. */
     112          27 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
     113             :                 &object, NumberFormatter_ce_ptr, &attribute ) == FAILURE )
     114             :         {
     115           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     116             :                         "numfmt_get_text_attribute: unable to parse input params", 0 TSRMLS_CC );
     117             : 
     118           1 :                 RETURN_FALSE;
     119             :         }
     120             : 
     121             :         /* Fetch the object. */
     122          26 :         FORMATTER_METHOD_FETCH_OBJECT;
     123             : 
     124          26 :         length = unum_getTextAttribute( FORMATTER_OBJECT(nfo), attribute, value, value_buf_size, &INTL_DATA_ERROR_CODE(nfo) );
     125          26 :         if(INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR && length >= value_buf_size) {
     126           2 :                 ++length; /* to avoid U_STRING_NOT_TERMINATED_WARNING */
     127           2 :                 INTL_DATA_ERROR_CODE(nfo) = U_ZERO_ERROR;
     128           2 :                 value = eumalloc(length);
     129           2 :                 length = unum_getTextAttribute( FORMATTER_OBJECT(nfo), attribute, value, length, &INTL_DATA_ERROR_CODE(nfo) );
     130           2 :                 if(U_FAILURE(INTL_DATA_ERROR_CODE(nfo))) {
     131           0 :                         efree(value);
     132           0 :                         value = value_buf;
     133             :                 }
     134             :         }
     135          26 :         INTL_METHOD_CHECK_STATUS( nfo, "Error getting attribute value" );
     136             : 
     137          26 :         INTL_METHOD_RETVAL_UTF8( nfo, value, length, ( value != value_buf ) );
     138             : }
     139             : /* }}} */
     140             : 
     141             : /* {{{ proto bool NumberFormatter::setAttribute( int $attr, mixed $value )
     142             :  * Get formatter attribute value. }}} */
     143             : /* {{{ proto bool numfmt_set_attribute( NumberFormatter $nf, int $attr, mixed $value )
     144             :  * Get formatter attribute value.
     145             :  */
     146           5 : PHP_FUNCTION( numfmt_set_attribute )
     147             : {
     148             :         zend_long attribute;
     149             :         zval *value;
     150           5 :         FORMATTER_METHOD_INIT_VARS;
     151             : 
     152             :         /* Parse parameters. */
     153           5 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz",
     154             :                 &object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE)
     155             :         {
     156           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     157             :                         "numfmt_set_attribute: unable to parse input params", 0 TSRMLS_CC );
     158             : 
     159           1 :                 RETURN_FALSE;
     160             :         }
     161             : 
     162             :         /* Fetch the object. */
     163           4 :         FORMATTER_METHOD_FETCH_OBJECT;
     164             : 
     165           4 :         switch(attribute) {
     166             :                 case UNUM_PARSE_INT_ONLY:
     167             :                 case UNUM_GROUPING_USED:
     168             :                 case UNUM_DECIMAL_ALWAYS_SHOWN:
     169             :                 case UNUM_MAX_INTEGER_DIGITS:
     170             :                 case UNUM_MIN_INTEGER_DIGITS:
     171             :                 case UNUM_INTEGER_DIGITS:
     172             :                 case UNUM_MAX_FRACTION_DIGITS:
     173             :                 case UNUM_MIN_FRACTION_DIGITS:
     174             :                 case UNUM_FRACTION_DIGITS:
     175             :                 case UNUM_MULTIPLIER:
     176             :                 case UNUM_GROUPING_SIZE:
     177             :                 case UNUM_ROUNDING_MODE:
     178             :                 case UNUM_FORMAT_WIDTH:
     179             :                 case UNUM_PADDING_POSITION:
     180             :                 case UNUM_SECONDARY_GROUPING_SIZE:
     181             :                 case UNUM_SIGNIFICANT_DIGITS_USED:
     182             :                 case UNUM_MIN_SIGNIFICANT_DIGITS:
     183             :                 case UNUM_MAX_SIGNIFICANT_DIGITS:
     184             :                 case UNUM_LENIENT_PARSE:
     185           8 :                         convert_to_long_ex(value);
     186           4 :                         unum_setAttribute(FORMATTER_OBJECT(nfo), attribute, Z_LVAL_P(value));
     187           4 :                         break;
     188             :                 case UNUM_ROUNDING_INCREMENT:
     189           0 :                         convert_to_double_ex(value);
     190           0 :                         unum_setDoubleAttribute(FORMATTER_OBJECT(nfo), attribute, Z_DVAL_P(value));
     191           0 :                         break;
     192             :                 default:
     193           0 :                         INTL_DATA_ERROR_CODE(nfo) = U_UNSUPPORTED_ERROR;
     194             :                         break;
     195             :         }
     196             : 
     197           4 :         INTL_METHOD_CHECK_STATUS( nfo, "Error setting attribute value" );
     198             : 
     199           4 :         RETURN_TRUE;
     200             : }
     201             : /* }}} */
     202             : 
     203             : /* {{{ proto bool NumberFormatter::setTextAttribute( int $attr, string $value )
     204             :  * Get formatter attribute value. }}} */
     205             : /* {{{ proto bool numfmt_set_text_attribute( NumberFormatter $nf, int $attr, string $value )
     206             :  * Get formatter attribute value.
     207             :  */
     208          25 : PHP_FUNCTION( numfmt_set_text_attribute )
     209             : {
     210          25 :         int slength = 0;
     211          25 :         UChar *svalue = NULL;
     212             :         zend_long attribute;
     213             :         char *value;
     214             :         size_t len;
     215          25 :         FORMATTER_METHOD_INIT_VARS;
     216             : 
     217             :         /* Parse parameters. */
     218          25 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols",
     219             :                 &object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE)
     220             :         {
     221           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     222             :                         "numfmt_set_text_attribute: unable to parse input params", 0 TSRMLS_CC );
     223             : 
     224           1 :                 RETURN_FALSE;
     225             :         }
     226             : 
     227             :         /* Fetch the object. */
     228          24 :         FORMATTER_METHOD_FETCH_OBJECT;
     229             : 
     230             :         /* Convert given attribute value to UTF-16. */
     231          24 :         intl_convert_utf8_to_utf16(&svalue, &slength, value, len, &INTL_DATA_ERROR_CODE(nfo));
     232          24 :         INTL_METHOD_CHECK_STATUS( nfo, "Error converting attribute value to UTF-16" );
     233             : 
     234             :         /* Actually set new attribute value. */
     235          24 :         unum_setTextAttribute(FORMATTER_OBJECT(nfo), attribute, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
     236          24 :         if (svalue) {
     237          24 :                 efree(svalue);
     238             :         }
     239          24 :         INTL_METHOD_CHECK_STATUS( nfo, "Error setting text attribute" );
     240             : 
     241          24 :         RETURN_TRUE;
     242             : }
     243             : /* }}} */
     244             : 
     245             : /* {{{ proto string NumberFormatter::getSymbol( int $attr )
     246             :  * Get formatter symbol value. }}} */
     247             : /* {{{ proto string numfmt_get_symbol( NumberFormatter $nf, int $attr )
     248             :  * Get formatter symbol value.
     249             :  */
     250          89 : PHP_FUNCTION( numfmt_get_symbol )
     251             : {
     252             :         zend_long symbol;
     253             :         UChar value_buf[4];
     254          89 :         UChar *value = value_buf;
     255          89 :         int length = USIZE(value_buf);
     256          89 :         FORMATTER_METHOD_INIT_VARS;
     257             : 
     258             :         /* Parse parameters. */
     259          89 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
     260             :                 &object, NumberFormatter_ce_ptr, &symbol ) == FAILURE )
     261             :         {
     262           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     263             :                         "numfmt_get_symbol: unable to parse input params", 0 TSRMLS_CC );
     264             : 
     265           1 :                 RETURN_FALSE;
     266             :         }
     267             :         
     268          88 :         if(symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) {
     269           8 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "numfmt_get_symbol: invalid symbol value", 0 TSRMLS_CC );
     270           8 :                 RETURN_FALSE;
     271             :         }
     272             : 
     273             :         /* Fetch the object. */
     274          80 :         FORMATTER_METHOD_FETCH_OBJECT;
     275             : 
     276          80 :         length = unum_getSymbol(FORMATTER_OBJECT(nfo), symbol, value_buf, length, &INTL_DATA_ERROR_CODE(nfo));
     277          80 :         if(INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR && length >= USIZE( value_buf )) {
     278           4 :                 ++length; /* to avoid U_STRING_NOT_TERMINATED_WARNING */
     279           4 :                 INTL_DATA_ERROR_CODE(nfo) = U_ZERO_ERROR;
     280           4 :                 value = eumalloc(length);
     281           4 :                 length = unum_getSymbol(FORMATTER_OBJECT(nfo), symbol, value, length, &INTL_DATA_ERROR_CODE(nfo));
     282           4 :                 if(U_FAILURE(INTL_DATA_ERROR_CODE(nfo))) {
     283           0 :                         efree(value);
     284           0 :                         value = value_buf;
     285             :                 }
     286             :         }
     287          80 :         INTL_METHOD_CHECK_STATUS( nfo, "Error getting symbol value" );
     288             : 
     289         160 :         INTL_METHOD_RETVAL_UTF8( nfo, value, length, ( value_buf != value ) );
     290             : }
     291             : /* }}} */
     292             : 
     293             : /* {{{ proto bool NumberFormatter::setSymbol( int $attr, string $symbol )
     294             :  * Set formatter symbol value. }}} */
     295             : /* {{{ proto bool numfmt_set_symbol( NumberFormatter $nf, int $attr, string $symbol )
     296             :  * Set formatter symbol value.
     297             :  */
     298          85 : PHP_FUNCTION( numfmt_set_symbol )
     299             : {
     300             :         zend_long       symbol;
     301          85 :         char*      value     = NULL;
     302          85 :         size_t        value_len = 0;
     303          85 :         UChar*     svalue  = 0;
     304          85 :         int        slength = 0;
     305          85 :         FORMATTER_METHOD_INIT_VARS;
     306             : 
     307             :         /* Parse parameters. */
     308          85 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols",
     309             :                 &object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE )
     310             :         {
     311           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     312             :                         "numfmt_set_symbol: unable to parse input params", 0 TSRMLS_CC );
     313             : 
     314           1 :                 RETURN_FALSE;
     315             :         }
     316             :         
     317          84 :         if (symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) {
     318           4 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "numfmt_set_symbol: invalid symbol value", 0 TSRMLS_CC );
     319           4 :                 RETURN_FALSE;
     320             :         }
     321             : 
     322             :         /* Fetch the object. */
     323          80 :         FORMATTER_METHOD_FETCH_OBJECT;
     324             : 
     325             :         /* Convert given symbol to UTF-16. */
     326          80 :         intl_convert_utf8_to_utf16(&svalue, &slength, value, value_len, &INTL_DATA_ERROR_CODE(nfo));
     327          80 :         INTL_METHOD_CHECK_STATUS( nfo, "Error converting symbol value to UTF-16" );
     328             : 
     329             :         /* Actually set the symbol. */
     330          80 :         unum_setSymbol(FORMATTER_OBJECT(nfo), symbol, svalue, slength, &INTL_DATA_ERROR_CODE(nfo));
     331          80 :         if (svalue) {
     332          80 :                 efree(svalue);
     333             :         }
     334          80 :         INTL_METHOD_CHECK_STATUS( nfo, "Error setting symbol value" );
     335             : 
     336          80 :         RETURN_TRUE;
     337             : }
     338             : /* }}} */
     339             : 
     340             : /* {{{ proto string NumberFormatter::getPattern( )
     341             :  * Get formatter pattern. }}} */
     342             : /* {{{ proto string numfmt_get_pattern( NumberFormatter $nf )
     343             :  * Get formatter pattern.
     344             :  */
     345           9 : PHP_FUNCTION( numfmt_get_pattern )
     346             : {
     347             :         UChar  value_buf[64];
     348           9 :         int    length = USIZE( value_buf );
     349           9 :         UChar* value  = value_buf;
     350           9 :         FORMATTER_METHOD_INIT_VARS;
     351             : 
     352             :         /* Parse parameters. */
     353           9 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
     354             :                 &object, NumberFormatter_ce_ptr ) == FAILURE )
     355             :         {
     356           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     357             :                         "numfmt_get_pattern: unable to parse input params", 0 TSRMLS_CC );
     358             : 
     359           1 :                 RETURN_FALSE;
     360             :         }
     361             : 
     362             :         /* Fetch the object. */
     363           8 :         FORMATTER_METHOD_FETCH_OBJECT;
     364             : 
     365           8 :         length = unum_toPattern(FORMATTER_OBJECT(nfo), 0, value, length, &INTL_DATA_ERROR_CODE(nfo));
     366           8 :         if(INTL_DATA_ERROR_CODE(nfo) == U_BUFFER_OVERFLOW_ERROR && length >= USIZE( value_buf )) {
     367           4 :                 ++length; /* to avoid U_STRING_NOT_TERMINATED_WARNING */
     368           4 :                 INTL_DATA_ERROR_CODE(nfo) = U_ZERO_ERROR;
     369           4 :                 value = eumalloc(length);
     370           4 :                 length = unum_toPattern( FORMATTER_OBJECT(nfo), 0, value, length, &INTL_DATA_ERROR_CODE(nfo) );
     371           4 :                 if(U_FAILURE(INTL_DATA_ERROR_CODE(nfo))) {
     372           0 :                         efree(value);
     373           0 :                         value = value_buf;
     374             :                 }
     375             :         }
     376           8 :         INTL_METHOD_CHECK_STATUS( nfo, "Error getting formatter pattern" );
     377             : 
     378          16 :         INTL_METHOD_RETVAL_UTF8( nfo, value, length, ( value != value_buf ) );
     379             : }
     380             : /* }}} */
     381             : 
     382             : /* {{{ proto bool NumberFormatter::setPattern( string $pattern )
     383             :  * Set formatter pattern. }}} */
     384             : /* {{{ proto bool numfmt_set_pattern( NumberFormatter $nf, string $pattern )
     385             :  * Set formatter pattern.
     386             :  */
     387           6 : PHP_FUNCTION( numfmt_set_pattern )
     388             : {
     389           6 :         char*       value = NULL;
     390           6 :         size_t      value_len = 0;
     391           6 :         int         slength = 0;
     392           6 :         UChar*      svalue  = NULL;
     393           6 :         FORMATTER_METHOD_INIT_VARS;
     394             : 
     395             :         /* Parse parameters. */
     396           6 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
     397             :                 &object, NumberFormatter_ce_ptr, &value, &value_len ) == FAILURE )
     398             :         {
     399           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     400             :                         "numfmt_set_pattern: unable to parse input params", 0 TSRMLS_CC );
     401             : 
     402           1 :                 RETURN_FALSE;
     403             :         }
     404             : 
     405           5 :         FORMATTER_METHOD_FETCH_OBJECT;
     406             : 
     407             :         /* Convert given pattern to UTF-16. */
     408           5 :         intl_convert_utf8_to_utf16(&svalue, &slength, value, value_len, &INTL_DATA_ERROR_CODE(nfo));
     409           5 :         INTL_METHOD_CHECK_STATUS( nfo, "Error converting pattern to UTF-16" );
     410             : 
     411             :         /* TODO: add parse error information */
     412           5 :         unum_applyPattern(FORMATTER_OBJECT(nfo), 0, svalue, slength, NULL, &INTL_DATA_ERROR_CODE(nfo));
     413           5 :         if (svalue) {
     414           5 :                 efree(svalue);
     415             :         }
     416           5 :         INTL_METHOD_CHECK_STATUS( nfo, "Error setting pattern value" );
     417             : 
     418           5 :         RETURN_TRUE;
     419             : }
     420             : /* }}} */
     421             : 
     422             : /* {{{ proto string NumberFormatter::getLocale([int type])
     423             :  * Get formatter locale. }}} */
     424             : /* {{{ proto string numfmt_get_locale( NumberFormatter $nf[, int type] )
     425             :  * Get formatter locale.
     426             :  */
     427          13 : PHP_FUNCTION( numfmt_get_locale )
     428             : {
     429          13 :         zend_long type = ULOC_ACTUAL_LOCALE;
     430             :         char* loc;
     431          13 :         FORMATTER_METHOD_INIT_VARS;
     432             : 
     433             :         /* Parse parameters. */
     434          13 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l",
     435             :                 &object, NumberFormatter_ce_ptr, &type ) == FAILURE )
     436             :         {
     437           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
     438             :                         "numfmt_get_locale: unable to parse input params", 0 TSRMLS_CC );
     439             : 
     440           1 :                 RETURN_FALSE;
     441             :         }
     442             : 
     443             :         /* Fetch the object. */
     444          12 :         FORMATTER_METHOD_FETCH_OBJECT;
     445             : 
     446          12 :         loc = (char *)unum_getLocaleByType(FORMATTER_OBJECT(nfo), type, &INTL_DATA_ERROR_CODE(nfo));
     447          12 :         INTL_METHOD_CHECK_STATUS( nfo, "Error getting locale" );
     448          24 :         RETURN_STRING(loc);
     449             : }
     450             : /* }}} */
     451             : 
     452             : /*
     453             :  * Local variables:
     454             :  * tab-width: 4
     455             :  * c-basic-offset: 4
     456             :  * End:
     457             :  * vim600: noet sw=4 ts=4 fdm=marker
     458             :  * vim<600: noet sw=4 ts=4
     459             :  */

Generated by: LCOV version 1.10

Generated at Wed, 22 Oct 2014 07:24:50 +0000 (2 days ago)

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