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/collator - collator_create.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 17 21 81.0 %
Date: 2014-09-29 Functions: 2 3 66.7 %
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: Vadim Savchuk <vsavchuk@productengine.com>                  |
      14             :    |          Dmitry Lakhtyuk <dlakhtyuk@productengine.com>               |
      15             :    +----------------------------------------------------------------------+
      16             :  */
      17             : 
      18             : #ifdef HAVE_CONFIG_H
      19             : #include "config.h"
      20             : #endif
      21             : 
      22             : #include "php_intl.h"
      23             : #include "collator_class.h"
      24             : #include "collator_create.h"
      25             : #include "intl_data.h"
      26             : 
      27             : /* {{{ */
      28          71 : static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
      29             : {
      30             :         char*            locale;
      31          71 :         int              locale_len = 0;
      32             :         zval*            object;
      33             :         Collator_object* co;
      34             : 
      35          71 :         intl_error_reset( NULL TSRMLS_CC );
      36          71 :         object = return_value;
      37             :         /* Parse parameters. */
      38          71 :         if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
      39             :                 &locale, &locale_len ) == FAILURE )
      40             :         {
      41           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      42             :                         "collator_create: unable to parse input params", 0 TSRMLS_CC );
      43             :                 zval_dtor(return_value);
      44           1 :                 RETURN_NULL();
      45             :         }
      46             : 
      47          72 :         INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
      48          68 :         COLLATOR_METHOD_FETCH_OBJECT;
      49             : 
      50          68 :         if(locale_len == 0) {
      51           2 :                 locale = INTL_G(default_locale);
      52             :         }
      53             : 
      54             :         /* Open ICU collator. */
      55          68 :         co->ucoll = ucol_open( locale, COLLATOR_ERROR_CODE_P( co ) );
      56          68 :         INTL_CTOR_CHECK_STATUS(co, "collator_create: unable to open ICU collator");
      57             : }
      58             : /* }}} */ 
      59             : 
      60             : /* {{{ proto Collator collator_create( string $locale )
      61             :  * Create collator.
      62             :  */
      63          71 : PHP_FUNCTION( collator_create )
      64             : {
      65          71 :         object_init_ex( return_value, Collator_ce_ptr );
      66          71 :         collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
      67          71 : }
      68             : /* }}} */
      69             : 
      70             : /* {{{ proto Collator Collator::__construct( string $locale )
      71             :  * Collator object constructor.
      72             :  */
      73           0 : PHP_METHOD( Collator, __construct )
      74             : {
      75           0 :         return_value = getThis();
      76           0 :         collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
      77           0 : }
      78             : /* }}} */
      79             : 
      80             : /*
      81             :  * Local variables:
      82             :  * tab-width: 4
      83             :  * c-basic-offset: 4
      84             :  * End:
      85             :  * vim600: noet sw=4 ts=4 fdm=marker
      86             :  * vim<600: noet sw=4 ts=4
      87             :  */

Generated by: LCOV version 1.10

Generated at Mon, 29 Sep 2014 14:26:22 +0000 (3 days ago)

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