@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | |
14 | -declare( strict_types = 1 ); |
|
14 | +declare(strict_types = 1); |
|
15 | 15 | |
16 | 16 | |
17 | 17 | namespace UK; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param int|string $code The optional error code. (defaults to \E_ERROR) |
48 | 48 | * @param \Exception $previous Optional previous exception. |
49 | 49 | */ |
50 | - public function __construct( string $message, $code = \E_ERROR, \Exception $previous = null ) |
|
50 | + public function __construct(string $message, $code = \E_ERROR, \Exception $previous = null) |
|
51 | 51 | { |
52 | 52 | |
53 | 53 | // Call the parent constructor (\Exception) |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | * @param bool $appendPreviousByNewline If a prev. Exception is defined append it by a new line? (' ' other) |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - public function getErrorMessage( bool $appendPreviousByNewline = false ) : string |
|
73 | + public function getErrorMessage(bool $appendPreviousByNewline = false) : string |
|
74 | 74 | { |
75 | 75 | |
76 | 76 | // Getting a optional previous exception |
77 | 77 | $prev = $this->getPrevious(); |
78 | 78 | |
79 | - if ( \is_null( $prev ) ) |
|
79 | + if (\is_null($prev)) |
|
80 | 80 | { |
81 | 81 | // If no previous exception is used |
82 | 82 | return \sprintf( |
83 | 83 | '%s(%d): %s', |
84 | - static::GetCodeName( $this->getCode() ), |
|
84 | + static::GetCodeName($this->getCode()), |
|
85 | 85 | $this->getCode(), |
86 | 86 | $this->getMessage() |
87 | 87 | ); |
@@ -90,21 +90,21 @@ discard block |
||
90 | 90 | // Define the separator between current and previous exception. |
91 | 91 | $separator = $appendPreviousByNewline ? "\n" : ' '; |
92 | 92 | |
93 | - if ( ( $prev instanceof CoreException ) ) |
|
93 | + if (($prev instanceof CoreException)) |
|
94 | 94 | { |
95 | 95 | return \sprintf( |
96 | 96 | '%s(%d): %s%s%s', |
97 | - static::GetCodeName( $this->getCode() ), |
|
97 | + static::GetCodeName($this->getCode()), |
|
98 | 98 | $this->getCode(), |
99 | 99 | $this->getMessage(), |
100 | 100 | $separator, |
101 | - $prev->getErrorMessage( $appendPreviousByNewline ) |
|
101 | + $prev->getErrorMessage($appendPreviousByNewline) |
|
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
105 | 105 | return \sprintf( |
106 | 106 | '%s(%d): %s%s%s', |
107 | - static::GetCodeName( $this->getCode() ), |
|
107 | + static::GetCodeName($this->getCode()), |
|
108 | 108 | $this->getCode(), |
109 | 109 | $this->getMessage(), |
110 | 110 | $separator, |
@@ -132,34 +132,34 @@ discard block |
||
132 | 132 | * @param string $indentSpaces Spaces to use for a single indention level. |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public function toCustomString( int $subExceptionLevel = 0, string $indentSpaces = ' ' ) : string |
|
135 | + public function toCustomString(int $subExceptionLevel = 0, string $indentSpaces = ' ') : string |
|
136 | 136 | { |
137 | 137 | |
138 | 138 | // Concatenate the base error message from usable elements |
139 | 139 | $msg = \sprintf( |
140 | 140 | "%s%s in %s[%d]. %s", |
141 | - \str_repeat( $indentSpaces, $subExceptionLevel ), |
|
142 | - \get_class( $this ), |
|
141 | + \str_repeat($indentSpaces, $subExceptionLevel), |
|
142 | + \get_class($this), |
|
143 | 143 | $this->file, |
144 | 144 | $this->line, |
145 | - \str_replace( "\n", "\n" . \str_repeat( $indentSpaces, $subExceptionLevel ), $this->message ) |
|
145 | + \str_replace("\n", "\n" . \str_repeat($indentSpaces, $subExceptionLevel), $this->message) |
|
146 | 146 | ); |
147 | 147 | |
148 | 148 | // getting a may defined previous exception |
149 | 149 | $previous = $this->getPrevious(); |
150 | 150 | |
151 | 151 | // if no previous exception is defined return the current generated message |
152 | - if ( \is_null( $previous ) || ! ( $previous instanceof \Exception ) ) |
|
152 | + if (\is_null($previous) || ! ($previous instanceof \Exception)) |
|
153 | 153 | { |
154 | 154 | return $msg; |
155 | 155 | } |
156 | 156 | |
157 | 157 | // If previous message is a framework internal exception |
158 | - if ( $previous instanceof CoreException ) |
|
158 | + if ($previous instanceof CoreException) |
|
159 | 159 | { |
160 | 160 | |
161 | 161 | // Simple cast the exception to a string and append it with rewrite the indention |
162 | - $msg .= "\n" . $previous->toCustomString( $subExceptionLevel + 1, $indentSpaces ); |
|
162 | + $msg .= "\n" . $previous->toCustomString($subExceptionLevel + 1, $indentSpaces); |
|
163 | 163 | |
164 | 164 | // And return the message |
165 | 165 | return $msg; |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | // Concatenate the previous error message from usable elements |
172 | 172 | $msg .= \sprintf( |
173 | 173 | "\n%s%s %s in %s[%d]\n %s", |
174 | - \str_repeat( $indentSpaces, $subExceptionLevel + 1 ), |
|
175 | - \get_class( $previous ), |
|
176 | - static::GetCodeName( $previous->getCode() ), |
|
174 | + \str_repeat($indentSpaces, $subExceptionLevel + 1), |
|
175 | + \get_class($previous), |
|
176 | + static::GetCodeName($previous->getCode()), |
|
177 | 177 | $previous->file, |
178 | 178 | $previous->line, |
179 | - \str_replace( "\n", "\n" . \str_repeat( $indentSpaces, $subExceptionLevel + 1 ), $previous->message ) |
|
179 | + \str_replace("\n", "\n" . \str_repeat($indentSpaces, $subExceptionLevel + 1), $previous->message) |
|
180 | 180 | ); |
181 | 181 | |
182 | 182 | // And return the message |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | * @param int|string $code e.g.: \E_USER_ERROR |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - public static function GetCodeName( $code ) : string |
|
198 | + public static function GetCodeName($code) : string |
|
199 | 199 | { |
200 | 200 | |
201 | - switch ( $code ) |
|
201 | + switch ($code) |
|
202 | 202 | { |
203 | 203 | |
204 | 204 | case \E_ERROR: |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return 'STRICT'; |
227 | 227 | |
228 | 228 | default: |
229 | - if ( \is_string( $code ) ) |
|
229 | + if (\is_string($code)) |
|
230 | 230 | { |
231 | 231 | return $code; |
232 | 232 | } |