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 - Zend - zend_iterators.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 22 22 100.0 %
Date: 2014-12-13 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend Engine                                                          |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 2.00 of the Zend 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.zend.com/license/2_00.txt.                                |
      11             :    | If you did not receive a copy of the Zend license and are unable to  |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@zend.com so we can mail you a copy immediately.              |
      14             :    +----------------------------------------------------------------------+
      15             :    | Author: Wez Furlong <wez@thebrainroom.com>                           |
      16             :    |         Marcus Boerger <helly@php.net>                               |
      17             :    +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : /* $Id$ */
      21             : 
      22             : #include "zend.h"
      23             : #include "zend_API.h"
      24             : 
      25             : static zend_class_entry zend_iterator_class_entry;
      26             : 
      27             : static void iter_wrapper_free(zend_object *object TSRMLS_DC);
      28             : static void iter_wrapper_dtor(zend_object *object TSRMLS_DC);
      29             : 
      30             : static zend_object_handlers iterator_object_handlers = {
      31             :         0,
      32             :         iter_wrapper_free,
      33             :         iter_wrapper_dtor,
      34             :         NULL,
      35             :         NULL, /* prop read */
      36             :         NULL, /* prop write */
      37             :         NULL, /* read dim */
      38             :         NULL, /* write dim */
      39             :         NULL,
      40             :         NULL, /* get */
      41             :         NULL, /* set */
      42             :         NULL, /* has prop */
      43             :         NULL, /* unset prop */
      44             :         NULL, /* has dim */
      45             :         NULL, /* unset dim */
      46             :         NULL, /* props get */
      47             :         NULL, /* method get */
      48             :         NULL, /* call */
      49             :         NULL, /* get ctor */
      50             :         NULL, /* get class name */
      51             :         NULL, /* compare */
      52             :         NULL, /* cast */
      53             :         NULL  /* count */
      54             : };
      55             : 
      56       20622 : ZEND_API void zend_register_iterator_wrapper(TSRMLS_D)
      57             : {
      58       20622 :         INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
      59       20622 : }
      60             : 
      61        1529 : static void iter_wrapper_free(zend_object *object TSRMLS_DC)
      62             : {
      63        1529 :         zend_object_iterator *iter = (zend_object_iterator*)object;
      64        1529 :         iter->funcs->dtor(iter TSRMLS_CC);
      65        1529 : }
      66             : 
      67        1507 : static void iter_wrapper_dtor(zend_object *object TSRMLS_DC)
      68             : {
      69        1507 : }
      70             : 
      71        1529 : ZEND_API void zend_iterator_init(zend_object_iterator *iter TSRMLS_DC)
      72             : {
      73        1529 :         zend_object_std_init(&iter->std, &zend_iterator_class_entry TSRMLS_CC);
      74        1529 :         iter->std.handlers = &iterator_object_handlers;
      75        1529 : }
      76             : 
      77         876 : ZEND_API void zend_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
      78             : {
      79         876 :         if (--GC_REFCOUNT(iter) > 0) {
      80          10 :                 return;
      81             :         }
      82             : 
      83         866 :         zend_objects_store_del(&iter->std TSRMLS_CC);
      84             : }
      85             : 
      86        7241 : ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr TSRMLS_DC)
      87             : {
      88       14482 :         if (Z_TYPE_P(array_ptr) &&
      89        7241 :             Z_OBJ_HT_P(array_ptr) == &iterator_object_handlers) {
      90        6912 :                 return (zend_object_iterator *)Z_OBJ_P(array_ptr);
      91             :         }
      92         329 :         return NULL;
      93             : }
      94             : 
      95             : /*
      96             :  * Local variables:
      97             :  * tab-width: 4
      98             :  * c-basic-offset: 4
      99             :  * indent-tabs-mode: t
     100             :  * End:
     101             :  */

Generated by: LCOV version 1.10

Generated at Sat, 13 Dec 2014 06:16:10 +0000 (7 days ago)

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