function isError($data, $code = null)
    {
        if (!is_a($data, 'PEAR_Error')) {
            return false;
        }

        if (is_null($code)) {
            return true;
        } elseif (is_string($code)) {
            return $data->getMessage() == $code;
        }

        return $data->getCode() == $code;
    }
function isError($data, $code = null)
    {
        if (!is_a($data, 'PEAR_Error')) {
            return false;
        }

        if (is_null($code)) {
            return true;
        } elseif (is_string($code)) {
            return $data->getMessage() == $code;
        }

        return $data->getCode() == $code;
    }
function isError ( $ data , $ code = null ) { if ( ! is_a ( $ data , 'PEAR_Error' ) ) { return false ; } if ( is_null ( $ code ) ) { return true ; } elseif ( is_string ( $ code ) ) { return $ data -> getMessage ( ) == $ code ; } return $ data -> getCode ( ) == $ code ; }
Tell whether a value is a PEAR error.

@param   mixed $data   the value to test
@param   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
@access  public
@return  bool    true if parameter is an error
Tell whether a value is a PEAR error .