You are here

function PEAR_Error::toString in Calendar Systems 5

Make a string representation of this object.

@access public

Return value

string a string with an object summary

File

calendar/lib/PEAR.php, line 1057

Class

PEAR_Error
Standard PEAR error class for PHP 4

Code

function toString() {
  $modes = array();
  $levels = array(
    E_USER_NOTICE => 'notice',
    E_USER_WARNING => 'warning',
    E_USER_ERROR => 'error',
  );
  if ($this->mode & PEAR_ERROR_CALLBACK) {
    if (is_array($this->callback)) {
      $callback = (is_object($this->callback[0]) ? strtolower(get_class($this->callback[0])) : $this->callback[0]) . '::' . $this->callback[1];
    }
    else {
      $callback = $this->callback;
    }
    return sprintf('[%s: message="%s" code=%d mode=callback ' . 'callback=%s prefix="%s" info="%s"]', strtolower(get_class($this)), $this->message, $this->code, $callback, $this->error_message_prefix, $this->userinfo);
  }
  if ($this->mode & PEAR_ERROR_PRINT) {
    $modes[] = 'print';
  }
  if ($this->mode & PEAR_ERROR_TRIGGER) {
    $modes[] = 'trigger';
  }
  if ($this->mode & PEAR_ERROR_DIE) {
    $modes[] = 'die';
  }
  if ($this->mode & PEAR_ERROR_RETURN) {
    $modes[] = 'return';
  }
  return sprintf('[%s: message="%s" code=%d mode=%s level=%s ' . 'prefix="%s" info="%s"]', strtolower(get_class($this)), $this->message, $this->code, implode("|", $modes), $levels[$this->level], $this->error_message_prefix, $this->userinfo);
}