SPL-StandardPHPLibrary
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Exception Class Reference
Inheritance diagram for Exception:
Inheritance graph
Collaboration diagram for Exception:
Collaboration graph

Public Member Functions

 __construct ($message=NULL, $code=0)
 
 __toString ()
 
 getCode ()
 
 getFile ()
 
 getLine ()
 
 getMessage ()
 
 getTrace ()
 
 getTraceAsString ()
 

Protected Attributes

 $code
 
 $file
 
 $line
 
 $message
 

Private Member Functions

 __clone ()
 

Private Attributes

 $string
 
 $trace
 

Detailed Description

Basic Exception class.

Since
PHP 5.0

Definition at line 258 of file spl.php.

Constructor & Destructor Documentation

Exception::__construct (   $message = NULL,
  $code = 0 
)

Construct an exception.

Parameters
$messageSome text describing the exception
$codeSome code describing the exception

Definition at line 287 of file spl.php.

References $code, and $message.

287  {
288  if (func_num_args()) {
289  $this->message = $message;
290  }
291  $this->code = $code;
292  $this->file = __FILE__; // of throw clause
293  $this->line = __LINE__; // of throw clause
294  $this->trace = debug_backtrace();
295  $this->string = StringFormat($this);
296  }
$code
The code passed to the constructor.
Definition: spl.php:267
$message
The exception message.
Definition: spl.php:261

Member Function Documentation

Exception::__clone ( )
finalprivate

Prevent clone.

Definition at line 280 of file spl.php.

280 {}
Exception::__toString ( )
Returns
string representation of exception

Definition at line 341 of file spl.php.

References $string.

342  {
343  return $this->string;
344  }
$string
The string representations as generated during construction.
Definition: spl.php:264
Exception::getCode ( )
final
Returns
the code passed to the constructor

Definition at line 307 of file spl.php.

References $code.

308  {
309  return $this->code;
310  }
$code
The code passed to the constructor.
Definition: spl.php:267
Exception::getFile ( )
final
Returns
the name of the file where the exception was thrown

Definition at line 314 of file spl.php.

References $file.

315  {
316  return $this->file;
317  }
$file
The file name where the exception was instantiated.
Definition: spl.php:270
Exception::getLine ( )
final
Returns
the line number where the exception was thrown

Definition at line 321 of file spl.php.

References $line.

322  {
323  return $this->line;
324  }
$line
The line number where the exception was instantiated.
Definition: spl.php:273
Exception::getMessage ( )
final
Returns
the message passed to the constructor

Definition at line 300 of file spl.php.

References $message.

301  {
302  return $this->message;
303  }
$message
The exception message.
Definition: spl.php:261
Exception::getTrace ( )
final
Returns
the stack trace as array

Definition at line 328 of file spl.php.

References $trace.

329  {
330  return $this->trace;
331  }
$trace
The stack trace.
Definition: spl.php:276
Exception::getTraceAsString ( )
final
Returns
the stack trace as string

Definition at line 335 of file spl.php.

336  {
337  }

Member Data Documentation

Exception::$code
protected

The code passed to the constructor.

Definition at line 267 of file spl.php.

Referenced by __construct(), and getCode().

Exception::$file
protected

The file name where the exception was instantiated.

Definition at line 270 of file spl.php.

Referenced by getFile().

Exception::$line
protected

The line number where the exception was instantiated.

Definition at line 273 of file spl.php.

Referenced by getLine().

Exception::$message
protected

The exception message.

Definition at line 261 of file spl.php.

Referenced by __construct(), and getMessage().

Exception::$string
private

The string representations as generated during construction.

Definition at line 264 of file spl.php.

Referenced by __toString().

Exception::$trace
private

The stack trace.

Definition at line 276 of file spl.php.

Referenced by getTrace().


The documentation for this class was generated from the following file: