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: 2015-07-26 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend Engine                                                          |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2015 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);
      28             : static void iter_wrapper_dtor(zend_object *object);
      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             :         NULL, /* get_debug_info */
      55             :         NULL, /* get_closure */
      56             :         NULL, /* get_gc */
      57             :         NULL, /* do_operation */
      58             :         NULL  /* compare */
      59             : };
      60             : 
      61       21049 : ZEND_API void zend_register_iterator_wrapper(void)
      62             : {
      63       21049 :         INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL);
      64       21049 : }
      65             : 
      66        1586 : static void iter_wrapper_free(zend_object *object)
      67             : {
      68        1586 :         zend_object_iterator *iter = (zend_object_iterator*)object;
      69        1586 :         iter->funcs->dtor(iter);
      70        1586 : }
      71             : 
      72        1566 : static void iter_wrapper_dtor(zend_object *object)
      73             : {
      74        1566 : }
      75             : 
      76        1586 : ZEND_API void zend_iterator_init(zend_object_iterator *iter)
      77             : {
      78        1586 :         zend_object_std_init(&iter->std, &zend_iterator_class_entry);
      79        1586 :         iter->std.handlers = &iterator_object_handlers;
      80        1586 : }
      81             : 
      82         899 : ZEND_API void zend_iterator_dtor(zend_object_iterator *iter)
      83             : {
      84         899 :         if (--GC_REFCOUNT(iter) > 0) {
      85           8 :                 return;
      86             :         }
      87             : 
      88         891 :         zend_objects_store_del(&iter->std);
      89             : }
      90             : 
      91        7430 : ZEND_API zend_object_iterator* zend_iterator_unwrap(zval *array_ptr)
      92             : {
      93       14860 :         if (Z_TYPE_P(array_ptr) &&
      94        7430 :             Z_OBJ_HT_P(array_ptr) == &iterator_object_handlers) {
      95        7069 :                 return (zend_object_iterator *)Z_OBJ_P(array_ptr);
      96             :         }
      97         361 :         return NULL;
      98             : }
      99             : 
     100             : /*
     101             :  * Local variables:
     102             :  * tab-width: 4
     103             :  * c-basic-offset: 4
     104             :  * indent-tabs-mode: t
     105             :  * End:
     106             :  */

Generated by: LCOV version 1.10

Generated at Mon, 27 Jul 2015 02:32:15 +0000 (3 days ago)

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