@@ -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 $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, int $code = \E_ERROR, \Exception $previous = null ) |
|
50 | + public function __construct(string $message, int $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 $code e.g.: \E_USER_ERROR |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - public static function GetCodeName( int $code ) : string |
|
198 | + public static function GetCodeName(int $code) : string |
|
199 | 199 | { |
200 | 200 | |
201 | - switch ( $code ) |
|
201 | + switch ($code) |
|
202 | 202 | { |
203 | 203 | |
204 | 204 | case \E_ERROR: |
@@ -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; |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | * @param integer $line The error line. |
40 | 40 | * @param string $file The error file. |
41 | 41 | */ |
42 | - public function __construct( string $message, int $code, int $line, string $file ) |
|
42 | + public function __construct(string $message, int $code, int $line, string $file) |
|
43 | 43 | { |
44 | 44 | |
45 | 45 | // Call the parent constructor |
46 | - parent::__construct( \strip_tags( $message ), $code ); |
|
46 | + parent::__construct(\strip_tags($message), $code); |
|
47 | 47 | |
48 | 48 | // Setting the error file manually. |
49 | 49 | $this->file = $file; |
@@ -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; |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | * @param int $code The optional Error code (defaults to \E_ERROR) |
36 | 36 | * @param \Exception $previous A optional previous exception |
37 | 37 | */ |
38 | - public function __construct( string $message, int $code = \E_ERROR, \Exception $previous = null ) |
|
38 | + public function __construct(string $message, int $code = \E_ERROR, \Exception $previous = null) |
|
39 | 39 | { |
40 | 40 | |
41 | - parent::__construct( $message, $code, $previous ); |
|
41 | + parent::__construct($message, $code, $previous); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * @param string $message |
54 | 54 | * @return string |
55 | 55 | */ |
56 | - protected static function appendMessage( $message ) : string |
|
56 | + protected static function appendMessage($message) : string |
|
57 | 57 | { |
58 | 58 | |
59 | - return empty( $message ) ? '' : ( ' ' . $message ); |
|
59 | + return empty($message) ? '' : (' ' . $message); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 |
@@ -14,30 +14,30 @@ |
||
14 | 14 | * @access private |
15 | 15 | * @internal |
16 | 16 | */ |
17 | -function error_handler( $errNo, $errStr, $errFile, $errLine ) |
|
17 | +function error_handler($errNo, $errStr, $errFile, $errLine) |
|
18 | 18 | { |
19 | 19 | |
20 | - switch ( $errNo ) |
|
20 | + switch ($errNo) |
|
21 | 21 | { |
22 | 22 | |
23 | 23 | case \E_NOTICE: |
24 | 24 | case \E_USER_NOTICE: |
25 | 25 | case \E_STRICT: |
26 | - if ( ! CoreException::$debug && ! \defined( 'DEBUG' ) && ! \defined( 'UK_DEBUG' ) ) |
|
26 | + if ( ! CoreException::$debug && ! \defined('DEBUG') && ! \defined('UK_DEBUG')) |
|
27 | 27 | { |
28 | 28 | // Ignore notices and strict stuff if debug is not enabled |
29 | 29 | break; |
30 | 30 | } |
31 | - throw new \UK\PhpException( $errStr, $errNo, $errLine, $errFile ); |
|
31 | + throw new \UK\PhpException($errStr, $errNo, $errLine, $errFile); |
|
32 | 32 | break; |
33 | 33 | |
34 | 34 | default: |
35 | - throw new \UK\PhpException( $errStr, $errNo, $errLine, $errFile ); |
|
35 | + throw new \UK\PhpException($errStr, $errNo, $errLine, $errFile); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | -\set_error_handler( '\\UK\\error_handler' ); |
|
42 | +\set_error_handler('\\UK\\error_handler'); |
|
43 | 43 |