You are here

function PEAR::staticPushErrorHandling in Flickr API 5

File

phpFlickr/PEAR/PEAR.php, line 600

Class

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

Code

function staticPushErrorHandling($mode, $options = null) {
  $stack =& $GLOBALS['_PEAR_error_handler_stack'];
  $def_mode =& $GLOBALS['_PEAR_default_error_mode'];
  $def_options =& $GLOBALS['_PEAR_default_error_options'];
  $stack[] = array(
    $def_mode,
    $def_options,
  );
  switch ($mode) {
    case PEAR_ERROR_EXCEPTION:
    case PEAR_ERROR_RETURN:
    case PEAR_ERROR_PRINT:
    case PEAR_ERROR_TRIGGER:
    case PEAR_ERROR_DIE:
    case null:
      $def_mode = $mode;
      $def_options = $options;
      break;
    case PEAR_ERROR_CALLBACK:
      $def_mode = $mode;

      // class/object method callback
      if (is_callable($options)) {
        $def_options = $options;
      }
      else {
        trigger_error("invalid error callback", E_USER_WARNING);
      }
      break;
    default:
      trigger_error("invalid error mode", E_USER_WARNING);
      break;
  }
  $stack[] = array(
    $mode,
    $options,
  );
  return true;
}