function PEAR::PEAR in Calendar Systems 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
File
- calendar/
lib/ 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);
}
}
}