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/dom - domexception.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 33 59 55.9 %
Date: 2019-05-06 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 7                                                        |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) The PHP Group                                          |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 3.01 of the PHP license,      |
       8             :    | that is bundled with this package in the file LICENSE, and is        |
       9             :    | available through the world-wide-web at the following url:           |
      10             :    | http://www.php.net/license/3_01.txt                                  |
      11             :    | If you did not receive a copy of the PHP license and are unable to   |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@php.net so we can mail you a copy immediately.               |
      14             :    +----------------------------------------------------------------------+
      15             :    | Authors: Christian Stocker <chregu@php.net>                          |
      16             :    |          Rob Richards <rrichards@php.net>                            |
      17             :    +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : #ifdef HAVE_CONFIG_H
      21             : #include "config.h"
      22             : #endif
      23             : 
      24             : #include "php.h"
      25             : #if HAVE_LIBXML && HAVE_DOM
      26             : #include "php_dom.h"
      27             : 
      28             : /*
      29             : * class DOMException
      30             : *
      31             : * URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-17189187
      32             : * Since:
      33             : */
      34             : 
      35             : extern zend_class_entry *dom_domexception_class_entry;
      36             : 
      37             : const zend_function_entry php_dom_domexception_class_functions[] = {
      38             :         PHP_FE_END
      39             : };
      40             : 
      41          55 : void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error) /* {{{ */
      42             : {
      43          55 :         if (strict_error == 1) {
      44          46 :                 zend_throw_exception(dom_domexception_class_entry, error_message, error_code);
      45             :         } else {
      46           9 :                 php_libxml_issue_error(E_WARNING, error_message);
      47             :         }
      48          55 : }
      49             : /* }}} */
      50             : 
      51             : /* {{{ php_dom_throw_error */
      52          55 : void php_dom_throw_error(int error_code, int strict_error)
      53             : {
      54             :         char *error_message;
      55             : 
      56          55 :         switch (error_code)
      57             :         {
      58           5 :                 case INDEX_SIZE_ERR:
      59           5 :                         error_message = "Index Size Error";
      60           5 :                         break;
      61           0 :                 case DOMSTRING_SIZE_ERR:
      62           0 :                         error_message = "DOM String Size Error";
      63           0 :                         break;
      64           2 :                 case HIERARCHY_REQUEST_ERR:
      65           2 :                         error_message = "Hierarchy Request Error";
      66           2 :                         break;
      67           2 :                 case WRONG_DOCUMENT_ERR:
      68           2 :                         error_message = "Wrong Document Error";
      69           2 :                         break;
      70          14 :                 case INVALID_CHARACTER_ERR:
      71          14 :                         error_message = "Invalid Character Error";
      72          14 :                         break;
      73           0 :                 case NO_DATA_ALLOWED_ERR:
      74           0 :                         error_message = "No Data Allowed Error";
      75           0 :                         break;
      76           1 :                 case NO_MODIFICATION_ALLOWED_ERR:
      77           1 :                         error_message = "No Modification Allowed Error";
      78           1 :                         break;
      79           5 :                 case NOT_FOUND_ERR:
      80           5 :                         error_message = "Not Found Error";
      81           5 :                         break;
      82           0 :                 case NOT_SUPPORTED_ERR:
      83           0 :                         error_message = "Not Supported Error";
      84           0 :                         break;
      85           0 :                 case INUSE_ATTRIBUTE_ERR:
      86           0 :                         error_message = "Inuse Attribute Error";
      87           0 :                         break;
      88           8 :                 case INVALID_STATE_ERR:
      89           8 :                         error_message = "Invalid State Error";
      90           8 :                         break;
      91           0 :                 case SYNTAX_ERR:
      92           0 :                         error_message = "Syntax Error";
      93           0 :                         break;
      94           0 :                 case INVALID_MODIFICATION_ERR:
      95           0 :                         error_message = "Invalid Modification Error";
      96           0 :                         break;
      97          18 :                 case NAMESPACE_ERR:
      98          18 :                         error_message = "Namespace Error";
      99          18 :                         break;
     100           0 :                 case INVALID_ACCESS_ERR:
     101           0 :                         error_message = "Invalid Access Error";
     102           0 :                         break;
     103           0 :                 case VALIDATION_ERR:
     104           0 :                         error_message = "Validation Error";
     105           0 :                         break;
     106           0 :                 default:
     107           0 :                         error_message = "Unhandled Error";
     108             :         }
     109             : 
     110          55 :         php_dom_throw_error_with_message(error_code, error_message, strict_error);
     111          55 : }
     112             : /* }}} end php_dom_throw_error */
     113             : 
     114             : #endif /* HAVE_LIBXML && HAVE_DOM */

Generated by: LCOV version 1.10

Generated at Mon, 06 May 2019 17:58:13 +0000 (998 days ago)

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