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 - processinginstruction.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 0 46 0.0 %
Date: 2014-10-30 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | PHP Version 7                                                        |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1997-2014 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             : /* $Id$ */
      21             : 
      22             : #ifdef HAVE_CONFIG_H
      23             : #include "config.h"
      24             : #endif
      25             : 
      26             : #include "php.h"
      27             : #if HAVE_LIBXML && HAVE_DOM
      28             : #include "php_dom.h"
      29             : 
      30             : 
      31             : /* {{{ arginfo */
      32             : ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_processinginstruction_construct, 0, 0, 1)
      33             :         ZEND_ARG_INFO(0, name)
      34             :         ZEND_ARG_INFO(0, value)
      35             : ZEND_END_ARG_INFO();
      36             : /* }}} */
      37             : 
      38             : /*
      39             : * class DOMProcessingInstruction extends DOMNode 
      40             : *
      41             : * URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-1004215813
      42             : * Since: 
      43             : */
      44             : 
      45             : const zend_function_entry php_dom_processinginstruction_class_functions[] = {
      46             :         PHP_ME(domprocessinginstruction, __construct, arginfo_dom_processinginstruction_construct, ZEND_ACC_PUBLIC)
      47             :         PHP_FE_END
      48             : };
      49             : 
      50             : /* {{{ proto void DOMProcessingInstruction::__construct(string name, [string value]); */
      51           0 : PHP_METHOD(domprocessinginstruction, __construct)
      52             : {
      53             :         zval *id;
      54           0 :         xmlNodePtr nodep = NULL, oldnode = NULL;
      55             :         dom_object *intern;
      56           0 :         char *name, *value = NULL;
      57             :         size_t name_len, value_len;
      58             :         int name_valid;
      59             :         zend_error_handling error_handling;
      60             : 
      61           0 :         zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling TSRMLS_CC);
      62           0 :         if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|s", &id, dom_processinginstruction_class_entry, &name, &name_len, &value, &value_len) == FAILURE) {
      63           0 :                 zend_restore_error_handling(&error_handling TSRMLS_CC);
      64           0 :                 return;
      65             :         }
      66             : 
      67           0 :         zend_restore_error_handling(&error_handling TSRMLS_CC);
      68             : 
      69           0 :         name_valid = xmlValidateName((xmlChar *) name, 0);
      70           0 :         if (name_valid != 0) {
      71           0 :                 php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC);
      72           0 :                 RETURN_FALSE;
      73             :         }
      74             : 
      75           0 :         nodep = xmlNewPI((xmlChar *) name, (xmlChar *) value);
      76             : 
      77           0 :         if (!nodep) {
      78           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC);
      79           0 :                 RETURN_FALSE;
      80             :         }
      81             : 
      82           0 :         intern = Z_DOMOBJ_P(id);
      83           0 :         oldnode = dom_object_get_node(intern);
      84           0 :         if (oldnode != NULL) {
      85           0 :                 php_libxml_node_free_resource(oldnode  TSRMLS_CC);
      86             :         }
      87           0 :         php_libxml_increment_node_ptr((php_libxml_node_object *)intern, nodep, (void *)intern TSRMLS_CC);
      88             : }
      89             : /* }}} end DOMProcessingInstruction::__construct */
      90             : 
      91             : /* {{{ target   string  
      92             : readonly=yes 
      93             : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-1478689192
      94             : Since: 
      95             : */
      96           0 : int dom_processinginstruction_target_read(dom_object *obj, zval *retval TSRMLS_DC)
      97             : {
      98           0 :         xmlNodePtr nodep = dom_object_get_node(obj);
      99             : 
     100           0 :         if (nodep == NULL) {
     101           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     102           0 :                 return FAILURE;
     103             :         }
     104             : 
     105           0 :         ZVAL_STRING(retval, (char *) (nodep->name));
     106             : 
     107           0 :         return SUCCESS;
     108             : }
     109             : 
     110             : /* }}} */
     111             : 
     112             : /* {{{ data     string  
     113             : readonly=no 
     114             : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-837822393
     115             : Since: 
     116             : */
     117           0 : int dom_processinginstruction_data_read(dom_object *obj, zval *retval TSRMLS_DC)
     118             : {
     119             :         xmlNodePtr nodep;
     120             :         xmlChar *content;
     121             : 
     122           0 :         nodep = dom_object_get_node(obj);
     123             : 
     124           0 :         if (nodep == NULL) {
     125           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     126           0 :                 return FAILURE;
     127             :         }
     128             : 
     129           0 :         if ((content = xmlNodeGetContent(nodep)) != NULL) {
     130           0 :                 ZVAL_STRING(retval, (char *) content);
     131           0 :                 xmlFree(content);
     132             :         } else {
     133           0 :                 ZVAL_EMPTY_STRING(retval);
     134             :         }
     135             : 
     136           0 :         return SUCCESS;
     137             : }
     138             : 
     139           0 : int dom_processinginstruction_data_write(dom_object *obj, zval *newval TSRMLS_DC)
     140             : {
     141           0 :         xmlNode *nodep = dom_object_get_node(obj);
     142             :         zend_string *str;
     143             : 
     144           0 :         if (nodep == NULL) {
     145           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
     146           0 :                 return FAILURE;
     147             :         }
     148             : 
     149           0 :         str = zval_get_string(newval);
     150             : 
     151           0 :         xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
     152             : 
     153             :         zend_string_release(str);
     154           0 :         return SUCCESS;
     155             : }
     156             : 
     157             : /* }}} */
     158             : 
     159             : #endif
     160             : 
     161             : /*
     162             :  * Local variables:
     163             :  * tab-width: 4
     164             :  * c-basic-offset: 4
     165             :  * End:
     166             :  * vim600: noet sw=4 ts=4 fdm=marker
     167             :  * vim<600: noet sw=4 ts=4
     168             :  */

Generated by: LCOV version 1.10

Generated at Thu, 30 Oct 2014 07:41:29 +0000 (6 hours ago)

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