You are here

function _PEAR_call_destructors in Flickr API 5

2 string references to '_PEAR_call_destructors'
PEAR::PEAR in phpFlickr/PEAR/PEAR.php
Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.
PEAR::registerShutdownFunc in phpFlickr/PEAR/PEAR.php
Use this function to register a shutdown method for static classes.

File

phpFlickr/PEAR/PEAR.php, line 768

Code

function _PEAR_call_destructors() {
  global $_PEAR_destructor_object_list;
  if (is_array($_PEAR_destructor_object_list) && sizeof($_PEAR_destructor_object_list)) {
    reset($_PEAR_destructor_object_list);
    if (PEAR::getStaticProperty('PEAR', 'destructlifo')) {
      $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
    }
    while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
      $classname = get_class($objref);
      while ($classname) {
        $destructor = "_{$classname}";
        if (method_exists($objref, $destructor)) {
          $objref
            ->{$destructor}();
          break;
        }
        else {
          $classname = get_parent_class($classname);
        }
      }
    }

    // Empty the object list to ensure that destructors are
    // not called more than once.
    $_PEAR_destructor_object_list = array();
  }

  // Now call the shutdown functions
  if (is_array($GLOBALS['_PEAR_shutdown_funcs']) and !empty($GLOBALS['_PEAR_shutdown_funcs'])) {
    foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
      call_user_func_array($value[0], $value[1]);
    }
  }
}