You are here

function PEAR::delExpect in Calendar Systems 5

This method deletes all occurences of the specified element from the expected error codes stack.

@access public @since PHP 4.3.0

Parameters

mixed $error_code error code that should be deleted:

Return value

mixed list of error codes that were deleted or error

File

calendar/lib/PEAR.php, line 454

Class

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

Code

function delExpect($error_code) {
  $deleted = false;
  if (is_array($error_code) && 0 != count($error_code)) {

    // $error_code is a non-empty array here;
    // we walk through it trying to unset all
    // values
    foreach ($error_code as $key => $error) {
      if ($this
        ->_checkDelExpect($error)) {
        $deleted = true;
      }
      else {
        $deleted = false;
      }
    }
    return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist");

    // IMPROVE ME
  }
  elseif (!empty($error_code)) {

    // $error_code comes alone, trying to unset it
    if ($this
      ->_checkDelExpect($error_code)) {
      return true;
    }
    else {
      return PEAR::raiseError("The expected error you submitted does not exist");

      // IMPROVE ME
    }
  }
  else {

    // $error_code is empty
    return PEAR::raiseError("The expected error you submitted is empty");

    // IMPROVE ME
  }
}