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_error.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 18 20 90.0 %
Date: 2014-04-10 Functions: 2 2 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_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           5 : PHP_FUNCTION( collator_get_error_code )
      32             : {
      33           5 :         COLLATOR_METHOD_INIT_VARS
      34             : 
      35             :         /* Parse parameters. */
      36           5 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
      37             :                 &object, Collator_ce_ptr ) == FAILURE )
      38             :         {
      39           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      40             :                         "collator_get_error_code: unable to parse input params", 0 TSRMLS_CC );
      41             : 
      42           1 :                 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           5 : PHP_FUNCTION( collator_get_error_message )
      61             : {
      62           5 :         const char* message = NULL;
      63             : 
      64           5 :         COLLATOR_METHOD_INIT_VARS
      65             : 
      66             :         /* Parse parameters. */
      67           5 :         if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
      68             :                 &object, Collator_ce_ptr ) == FAILURE )
      69             :         {
      70           1 :                 intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
      71             :                         "collator_get_error_message: unable to parse input params", 0 TSRMLS_CC );
      72             : 
      73           1 :                 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: LCOV version 1.10

Generated at Thu, 10 Apr 2014 08:53:50 +0000 (9 days ago)

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