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 44 0.0 %
Date: 2015-07-31 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-2015 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           0 :         zval *id = getThis();
      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             : 
      60           0 :         if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
      61           0 :                 return;
      62             :         }
      63             : 
      64           0 :         name_valid = xmlValidateName((xmlChar *) name, 0);
      65           0 :         if (name_valid != 0) {
      66           0 :                 php_dom_throw_error(INVALID_CHARACTER_ERR, 1);
      67           0 :                 RETURN_FALSE;
      68             :         }
      69             : 
      70           0 :         nodep = xmlNewPI((xmlChar *) name, (xmlChar *) value);
      71             : 
      72           0 :         if (!nodep) {
      73           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 1);
      74           0 :                 RETURN_FALSE;
      75             :         }
      76             : 
      77           0 :         intern = Z_DOMOBJ_P(id);
      78           0 :         oldnode = dom_object_get_node(intern);
      79           0 :         if (oldnode != NULL) {
      80           0 :                 php_libxml_node_free_resource(oldnode );
      81             :         }
      82           0 :         php_libxml_increment_node_ptr((php_libxml_node_object *)intern, nodep, (void *)intern);
      83             : }
      84             : /* }}} end DOMProcessingInstruction::__construct */
      85             : 
      86             : /* {{{ target   string
      87             : readonly=yes
      88             : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-1478689192
      89             : Since:
      90             : */
      91           0 : int dom_processinginstruction_target_read(dom_object *obj, zval *retval)
      92             : {
      93           0 :         xmlNodePtr nodep = dom_object_get_node(obj);
      94             : 
      95           0 :         if (nodep == NULL) {
      96           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 0);
      97           0 :                 return FAILURE;
      98             :         }
      99             : 
     100           0 :         ZVAL_STRING(retval, (char *) (nodep->name));
     101             : 
     102           0 :         return SUCCESS;
     103             : }
     104             : 
     105             : /* }}} */
     106             : 
     107             : /* {{{ data     string
     108             : readonly=no
     109             : URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-837822393
     110             : Since:
     111             : */
     112           0 : int dom_processinginstruction_data_read(dom_object *obj, zval *retval)
     113             : {
     114             :         xmlNodePtr nodep;
     115             :         xmlChar *content;
     116             : 
     117           0 :         nodep = dom_object_get_node(obj);
     118             : 
     119           0 :         if (nodep == NULL) {
     120           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 0);
     121           0 :                 return FAILURE;
     122             :         }
     123             : 
     124           0 :         if ((content = xmlNodeGetContent(nodep)) != NULL) {
     125           0 :                 ZVAL_STRING(retval, (char *) content);
     126           0 :                 xmlFree(content);
     127             :         } else {
     128           0 :                 ZVAL_EMPTY_STRING(retval);
     129             :         }
     130             : 
     131           0 :         return SUCCESS;
     132             : }
     133             : 
     134           0 : int dom_processinginstruction_data_write(dom_object *obj, zval *newval)
     135             : {
     136           0 :         xmlNode *nodep = dom_object_get_node(obj);
     137             :         zend_string *str;
     138             : 
     139           0 :         if (nodep == NULL) {
     140           0 :                 php_dom_throw_error(INVALID_STATE_ERR, 0);
     141           0 :                 return FAILURE;
     142             :         }
     143             : 
     144           0 :         str = zval_get_string(newval);
     145             : 
     146           0 :         xmlNodeSetContentLen(nodep, (xmlChar *) str->val, str->len + 1);
     147             : 
     148             :         zend_string_release(str);
     149           0 :         return SUCCESS;
     150             : }
     151             : 
     152             : /* }}} */
     153             : 
     154             : #endif
     155             : 
     156             : /*
     157             :  * Local variables:
     158             :  * tab-width: 4
     159             :  * c-basic-offset: 4
     160             :  * End:
     161             :  * vim600: noet sw=4 ts=4 fdm=marker
     162             :  * vim<600: noet sw=4 ts=4
     163             :  */

Generated by: LCOV version 1.10

Generated at Fri, 31 Jul 2015 08:58:48 +0000 (28 hours ago)

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