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_locale.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 16 17 94.1 %
Date: 2014-07-23 Functions: 1 1 100.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: 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_locale.h"
      25             : #include "intl_convert.h"
      26             : 
      27             : #include <zend_API.h>
      28             : 
      29             : /* {{{ proto string Collator::getLocale( int $type )
      30             :  * Gets the locale name of the collator. }}} */
      31             : /* {{{ proto string collator_get_locale( Collator $coll, int $type )
      32             :  * Gets the locale name of the collator.
      33             :  */
      34          42 : PHP_FUNCTION( collator_get_locale )
      35             : {
      36          42 :         long   type        = 0;
      37          42 :         char*  locale_name = NULL;
      38             : 
      39          42 :         COLLATOR_METHOD_INIT_VARS
      40             : 
      41             :         /* Parse parameters. */
      42          42 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol",
      43             :                 &object, Collator_ce_ptr, &type ) == FAILURE )
      44             :         {
      45           3 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      46             :                         "collator_get_locale: unable to parse input params", 0 TSRMLS_CC );
      47             : 
      48           3 :                 RETURN_FALSE;
      49             :         }
      50             : 
      51             :         /* Fetch the object. */
      52          39 :         COLLATOR_METHOD_FETCH_OBJECT;
      53             : 
      54          39 :         if (!co || !co->ucoll) {
      55           1 :                 intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) TSRMLS_CC );
      56           1 :                 intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
      57             :                         "Object not initialized", 0 TSRMLS_CC );
      58           1 :                 php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Object not initialized");
      59             : 
      60           0 :                 RETURN_FALSE;
      61             :         }
      62             : 
      63             :         /* Get locale by specified type. */
      64          76 :         locale_name = (char*) ucol_getLocaleByType(
      65          38 :                 co->ucoll, type, COLLATOR_ERROR_CODE_P( co ) );
      66          38 :         COLLATOR_CHECK_STATUS( co, "Error getting locale by type" );
      67             : 
      68             :         /* Return it. */
      69          30 :         RETVAL_STRINGL( locale_name, strlen(locale_name), TRUE );
      70             : }
      71             : /* }}} */
      72             : 
      73             : /*
      74             :  * Local variables:
      75             :  * tab-width: 4
      76             :  * c-basic-offset: 4
      77             :  * End:
      78             :  * vim600: noet sw=4 ts=4 fdm=marker
      79             :  * vim<600: noet sw=4 ts=4
      80             :  */

Generated by: LCOV version 1.10

Generated at Wed, 23 Jul 2014 19:58:32 +0000 (18 hours ago)

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