You are here

function PEAR::PEAR in Flickr API 5

Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.

@access public

Parameters

string $error_class (optional) which class to use for: error objects, defaults to PEAR_Error.

Return value

void

2 calls to PEAR::PEAR()
DB_common::DB_common in phpFlickr/PEAR/DB/common.php
This constructor calls <kbd>$this->PEAR('DB_Error')</kbd>
DB_storage::DB_storage in phpFlickr/PEAR/DB/storage.php
Constructor

File

phpFlickr/PEAR/PEAR.php, line 169

Class

PEAR
Base class for other PEAR classes. Provides rudimentary emulation of destructors.

Code

function PEAR($error_class = null) {
  $classname = strtolower(get_class($this));
  if ($this->_debug) {
    print "PEAR constructor called, class={$classname}\n";
  }
  if ($error_class !== null) {
    $this->_error_class = $error_class;
  }
  while ($classname && strcasecmp($classname, "pear")) {
    $destructor = "_{$classname}";
    if (method_exists($this, $destructor)) {
      global $_PEAR_destructor_object_list;
      $_PEAR_destructor_object_list[] =& $this;
      if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
        register_shutdown_function("_PEAR_call_destructors");
        $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
      }
      break;
    }
    else {
      $classname = get_parent_class($classname);
    }
  }
}