1 | <?php |
||
25 | class CoreException extends \Exception |
||
26 | { |
||
27 | |||
28 | |||
29 | // <editor-fold desc="// = = = = P U B L I C S T A T I C F I E L D S = = = = = = = = = = = = = = = = = = ="> |
||
30 | |||
31 | /** |
||
32 | * If this value is set to true Notices will trigger an exception |
||
33 | * |
||
34 | * @type bool |
||
35 | */ |
||
36 | public static $debug = false; |
||
37 | |||
38 | // </editor-fold> |
||
39 | |||
40 | |||
41 | // <editor-fold desc="// = = = = P U B L I C C O N S T R U C T O R = = = = = = = = = = = = = = = = = = = = ="> |
||
42 | |||
43 | /** |
||
44 | * Init's a new instance. |
||
45 | * |
||
46 | * @param string $message The error message |
||
47 | * @param int|string $code The optional error code. (defaults to \E_ERROR) |
||
48 | * @param \Exception $previous Optional previous exception. |
||
49 | */ |
||
50 | 3 | public function __construct( string $message, $code = \E_ERROR, \Exception $previous = null ) |
|
61 | |||
62 | // </editor-fold> |
||
63 | |||
64 | |||
65 | // <editor-fold desc="// = = = = P U B L I C M E T H O D S = = = = = = = = = = = = = = = = = = = = = = = = ="> |
||
66 | |||
67 | /** |
||
68 | * Extends the origin getMessage method, so also previous messages are include, if defined. |
||
69 | * |
||
70 | * @param bool $appendPreviousByNewline If a prev. Exception is defined append it by a new line? (' ' other) |
||
71 | * @return string |
||
72 | */ |
||
73 | 3 | public function getErrorMessage( bool $appendPreviousByNewline = false ) : string |
|
115 | |||
116 | /** |
||
117 | * Overrides __toString, to return a more detailed string, when object is casted to a string. |
||
118 | * |
||
119 | * @return string |
||
120 | */ |
||
121 | 3 | public final function __toString() |
|
127 | |||
128 | /** |
||
129 | * Allows the definition of the sub exception level if there is a parent exception that contains this exception. |
||
130 | * |
||
131 | * @param int $subExceptionLevel |
||
132 | * @param string $indentSpaces Spaces to use for a single indention level. |
||
133 | * @return string |
||
134 | */ |
||
135 | 3 | public function toCustomString( int $subExceptionLevel = 0, string $indentSpaces = ' ' ) : string |
|
186 | |||
187 | // </editor-fold> |
||
188 | |||
189 | |||
190 | // <editor-fold desc="// = = = = P U B L I C S T A T I C M E T H O D S = = = = = = = = = = = = = = = = = ="> |
||
191 | |||
192 | /** |
||
193 | * Returns a string, representing the defined error code. |
||
194 | * |
||
195 | * @param int|string $code e.g.: \E_USER_ERROR |
||
196 | * @return string |
||
197 | */ |
||
198 | 3 | public static function GetCodeName( $code ) : string |
|
238 | |||
239 | // </editor-fold> |
||
240 | |||
241 | |||
242 | } |
||
243 | |||
244 |