You are here

function PEAR::isError in Calendar Systems 5

Tell whether a value is a PEAR error.

@access public

Parameters

mixed $data the value to test:

int $code if $data is an error object, return true: only if $code is a string and $obj->getMessage() == $code or $code is an integer and $obj->getCode() == $code

Return value

bool true if parameter is an error

3 calls to PEAR::isError()
cmfcClassesCore::isError in calendar/lib/classesCore.class.inc.php
Tell whether a value is a PEAR error.
cmfcClassesCore::runCommand in calendar/lib/classesCore.class.inc.php
* @example * <code> * $this->runCommand('sendEmailAfterActivation',$columnsValues); * </code>
cmfcClassesCore::setOptions in calendar/lib/classesCore.class.inc.php
1 method overrides PEAR::isError()
cmfcClassesCore::isError in calendar/lib/classesCore.class.inc.php
Tell whether a value is a PEAR error.

File

calendar/lib/PEAR.php, line 278

Class

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

Code

function isError($data, $code = null) {
  if (is_a($data, 'PEAR_Error')) {
    if (is_null($code)) {
      return true;
    }
    elseif (is_string($code)) {
      return $data
        ->getMessage() == $code;
    }
    else {
      return $data
        ->getCode() == $code;
    }
  }
  return false;
}