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

LTP GCOV extension - code coverage report
Current view: directory - intl/collator - collator_error.c
Test: PHP Code Coverage
Date: 2009-11-21 Instrumented lines: 20
Code covered: 70.0 % Executed lines: 14
Legend: not executed executed

       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_error.h"
      25                 : 
      26                 : /* {{{ proto int Collator::getErrorCode( Collator $coll )
      27                 :  * Get collator's last error code. }}} */
      28                 : /* {{{ proto int collator_get_error_code( Collator $coll )
      29                 :  * Get collator's last error code.
      30                 :  */
      31                 : PHP_FUNCTION( collator_get_error_code )
      32               4 : {
      33               4 :         COLLATOR_METHOD_INIT_VARS
      34                 : 
      35                 :         /* Parse parameters. */
      36               4 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
      37                 :                 &object, Collator_ce_ptr ) == FAILURE )
      38                 :         {
      39               0 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      40                 :                         "collator_get_error_code: unable to parse input params", 0 TSRMLS_CC );
      41                 : 
      42               0 :                 RETURN_FALSE;
      43                 :         }
      44                 : 
      45                 :         /* Fetch the object (without resetting its last error code). */
      46               4 :         co = (Collator_object *) zend_object_store_get_object(object TSRMLS_CC);
      47               4 :         if( co == NULL )
      48               0 :                 RETURN_FALSE;
      49                 : 
      50                 :         /* Return collator's last error code. */
      51               4 :         RETURN_LONG( COLLATOR_ERROR_CODE( co ) );
      52                 : }
      53                 : /* }}} */
      54                 : 
      55                 : /* {{{ proto string Collator::getErrorMessage( Collator $coll )
      56                 :  * Get text description for collator's last error code. }}} */
      57                 : /* {{{ proto string collator_get_error_message( Collator $coll )
      58                 :  * Get text description for collator's last error code.
      59                 :  */
      60                 : PHP_FUNCTION( collator_get_error_message )
      61               4 : {
      62               4 :         const char* message = NULL;
      63                 : 
      64               4 :         COLLATOR_METHOD_INIT_VARS
      65                 : 
      66                 :         /* Parse parameters. */
      67               4 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
      68                 :                 &object, Collator_ce_ptr ) == FAILURE )
      69                 :         {
      70               0 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      71                 :                         "collator_get_error_message: unable to parse input params", 0 TSRMLS_CC );
      72                 : 
      73               0 :                 RETURN_FALSE;
      74                 :         }
      75                 : 
      76                 :         /* Fetch the object (without resetting its last error code). */
      77               4 :         co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC );
      78               4 :         if( co == NULL )
      79               0 :                 RETURN_FALSE;
      80                 : 
      81                 :         /* Return last error message. */
      82               4 :         message = intl_error_get_message( COLLATOR_ERROR_P( co ) TSRMLS_CC );
      83               4 :         RETURN_STRING( (char*)message, FALSE );
      84                 : }
      85                 : /* }}} */
      86                 : 
      87                 : /*
      88                 :  * Local variables:
      89                 :  * tab-width: 4
      90                 :  * c-basic-offset: 4
      91                 :  * End:
      92                 :  * vim600: noet sw=4 ts=4 fdm=marker
      93                 :  * vim<600: noet sw=4 ts=4
      94                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:27:01 +0000 (3 days ago)

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