SPL-StandardPHPLibrary
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
Exception Class Reference
Inheritance diagram for Exception:
Inheritance graph
[legend]

List of all members.

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.

                                                     {
        if (func_num_args()) {
            $this->message = $message;
        }
        $this->code = $code;
        $this->file = __FILE__; // of throw clause
        $this->line = __LINE__; // of throw clause
        $this->trace = debug_backtrace();
        $this->string = StringFormat($this);
    }

Member Function Documentation

Exception::__clone ( ) [final, private]

Prevent clone.

Definition at line 280 of file spl.php.

{}
Exception::__toString ( )
Returns:
string represenation of exception

Definition at line 341 of file spl.php.

    {
        return $this->string;
    }
Exception::getCode ( ) [final]
Returns:
the code passed to the constructor

Definition at line 307 of file spl.php.

    {
        return $this->code;
    }
Exception::getFile ( ) [final]
Returns:
the name of the file where the exception was thrown

Definition at line 314 of file spl.php.

    {
        return $this->file;
    }
Exception::getLine ( ) [final]
Returns:
the line number where the exception was thrown

Definition at line 321 of file spl.php.

    {
        return $this->line;
    }
Exception::getMessage ( ) [final]
Returns:
the message passed to the constructor

Definition at line 300 of file spl.php.

    {
        return $this->message;
    }
Exception::getTrace ( ) [final]
Returns:
the stack trace as array

Definition at line 328 of file spl.php.

    {
        return $this->trace;
    }
Exception::getTraceAsString ( ) [final]
Returns:
the stack trace as string

Definition at line 335 of file spl.php.

    {
    }

Member Data Documentation

Exception::$code [protected]

The code passed to the constructor.

Definition at line 267 of file spl.php.

Referenced by __construct().

Exception::$file [protected]

The file name where the exception was instantiated.

Definition at line 270 of file spl.php.

Exception::$line [protected]

The line number where the exception was instantiated.

Definition at line 273 of file spl.php.

Exception::$message [protected]

The exception message.

Definition at line 261 of file spl.php.

Referenced by __construct().

Exception::$string [private]

The string represenations as generated during construction.

Definition at line 264 of file spl.php.

Exception::$trace [private]

The stack trace.

Definition at line 276 of file spl.php.


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