Class miErrorsCollection

Description

Keep errors which arise during script life

  • copyright: Mirchev Ideas Ltd. © 2003, 2004

Located in /util/ErrorsCollection.inc (line 35)


	
			
Method Summary
 void addError (int $level, mixed $desc, int $code)
 array getErrors ()
 array getLastError ()
 int getNumErrors ()
 boolean hasErrors ()
Methods
addError (line 64)

Adds error.

You need to specify error level and error description. The $code parameter is not compulsory.

Example:


1 <?php
2 $UserErrors = new miErrorsCollection;
3 $UserErrors->addError(ERRORLEVEL_CRITICAL, 'User error description');
4 ?>

  • access: public
void addError (int $level, mixed $desc, int $code)
  • int $level: error level
  • mixed $desc: description of error
  • int $code: error code
getErrors (line 91)

Returns an array with all errors

Example:


1 <?php
2 $UserErrors = new miErrorsCollection;
3 ...
4 $errors = $UserErrors->getErrors();
5 ?>

  • return: array with all errors
  • access: public
array getErrors ()
getLastError (line 110)

Returns last error. If there aren't any errors returns false

Example:


1 <?php
2 $UserErrors = new miErrorsCollection;
3 ...
4 $error = $UserErrors->getLastError();
5 ?>

  • return: array with last occured error
  • access: public
array getLastError ()
getNumErrors (line 133)

Returns the number of errors

Example:


1 <?php
2 $UserErrors = new miErrorsCollection;
3 ...
4 $count = $UserErrors->getNumErrors();
5 ?>

  • return: number of occured errors
  • access: public
int getNumErrors ()
hasErrors (line 155)

Returns true if there are any errors in this object

Example:


1 <?php
2 $UserErrors = new miErrorsCollection;
3 ...
4 if ($UserErrors->hasErrors()) {
5 //tracking error
6 {
7 ?>

  • return: true if there are errors, false otherwise
  • access: public
boolean hasErrors ()

Documentation generated on Mon, 18 Oct 2004 14:58:31 +0300 by phpDocumentor 1.2.3