# Class yii\debug\FlattenException

Inheritance | yii\debug\FlattenException
Available since version | 2.0.10
Source Code | https://github.com/yiisoft/yii2-debug/blob/master/FlattenException.php

FlattenException wraps a PHP Exception to be able to serialize it.

Implements the Throwable interface Basically, this class removes all objects from the trace. Ported from Symfony components @link https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/Exception/FlattenException.php

## Protected Properties

Hide inherited properties

Property | Type | Description | Defined By
--- | --- | --- | ---
$code | mixed|integer |  | yii\debug\FlattenException
$file | string |  | yii\debug\FlattenException
$line | integer |  | yii\debug\FlattenException
$message | string |  | yii\debug\FlattenException

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
__construct() | FlattenException constructor. | yii\debug\FlattenException
__toString() | String representation of the exception | yii\debug\FlattenException
getClass() |  | yii\debug\FlattenException
getCode() | Gets the Exception code | yii\debug\FlattenException
getFile() | Gets the file in which the exception occurred | yii\debug\FlattenException
getLine() | Gets the line in which the exception occurred | yii\debug\FlattenException
getMessage() | Gets the Exception message | yii\debug\FlattenException
getPrevious() | Returns previous Exception | yii\debug\FlattenException
getTrace() | Gets the stack trace | yii\debug\FlattenException
getTraceAsString() | Gets the stack trace as a string | yii\debug\FlattenException

## Protected Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
setClass() |  | yii\debug\FlattenException
setCode() |  | yii\debug\FlattenException
setFile() |  | yii\debug\FlattenException
setLine() |  | yii\debug\FlattenException
setMessage() |  | yii\debug\FlattenException
setPrevious() |  | yii\debug\FlattenException
setToString() |  | yii\debug\FlattenException
setTrace() |  | yii\debug\FlattenException

## Property Details

$code protected property
protected mixed|integer $code = null
$file protected property
protected string $file = null
$line protected property
protected integer $line = null
$message protected property
protected string $message = null

## Method Details

__construct() public method

FlattenException constructor.

public void __construct ( Exception $exception )
$exception | Exception |

__toString() public method

String representation of the exception

public string __toString ( )
return | string | The string representation of the exception.

getClass() public method

public string getClass ( )
return | string | The name of the class in which the exception was created.

getCode() public method

Gets the Exception code

public mixed|integer getCode ( )
return | mixed|integer | The exception code as integer.

getFile() public method

Gets the file in which the exception occurred

public string getFile ( )
return | string | The filename in which the exception was created.

getLine() public method

Gets the line in which the exception occurred

public integer getLine ( )
return | integer | The line number where the exception was created.

getMessage() public method

Gets the Exception message

public string getMessage ( )
return | string | The Exception message as a string.

getPrevious() public method

Returns previous Exception

public yii\debug\FlattenException getPrevious ( )
return | yii\debug\FlattenException | The previous `FlattenException` if available or null otherwise.

getTrace() public method

Gets the stack trace

public array getTrace ( )
return | array | The Exception stack trace as an array.

getTraceAsString() public method

Gets the stack trace as a string

public string getTraceAsString ( )
return | string | The Exception stack trace as a string.

setClass() protected method

protected void setClass ( $class )
$class | string | The name of the class in which the exception was created.

setCode() protected method

protected void setCode ( $code )
$code | mixed|integer | The exception code as integer.

setFile() protected method

protected void setFile ( $file )
$file | string | The filename in which the exception was created.

setLine() protected method

protected void setLine ( $line )
$line | integer | The line number where the exception was created.

setMessage() protected method

protected void setMessage ( $message )
$message | string | The Exception message as a string.

setPrevious() protected method

protected void setPrevious ( yii\debug\FlattenException $previous )
$previous | yii\debug\FlattenException | Previous Exception.

setToString() protected method

protected void setToString ( $string )
$string | string | The string representation of the thrown object.

setTrace() protected method

protected void setTrace ( $trace )
$trace | array | The Exception stack trace as an array.