@@ -18,49 +18,49 @@ discard block |
||
| 18 | 18 | const CONTEXT_COMMAND_LINE = 'cli'; |
| 19 | 19 | const CONTEXT_WEB = 'web'; |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var Throwable |
|
| 23 | - */ |
|
| 21 | + /** |
|
| 22 | + * @var Throwable |
|
| 23 | + */ |
|
| 24 | 24 | protected $exception; |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var ConvertHelper_ThrowableInfo_Call[] |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var ConvertHelper_ThrowableInfo_Call[] |
|
| 28 | + */ |
|
| 29 | 29 | protected $calls = array(); |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var integer |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var integer |
|
| 33 | + */ |
|
| 34 | 34 | protected $code; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | protected $message; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var integer |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var integer |
|
| 43 | + */ |
|
| 44 | 44 | protected $callsCount = 0; |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var ConvertHelper_ThrowableInfo |
|
| 48 | - */ |
|
| 46 | + /** |
|
| 47 | + * @var ConvertHelper_ThrowableInfo |
|
| 48 | + */ |
|
| 49 | 49 | protected $previous; |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @var string |
|
| 53 | - */ |
|
| 51 | + /** |
|
| 52 | + * @var string |
|
| 53 | + */ |
|
| 54 | 54 | protected $referer = ''; |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @var DateTime |
|
| 58 | - */ |
|
| 56 | + /** |
|
| 57 | + * @var DateTime |
|
| 58 | + */ |
|
| 59 | 59 | protected $date; |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @var string |
|
| 63 | - */ |
|
| 61 | + /** |
|
| 62 | + * @var string |
|
| 63 | + */ |
|
| 64 | 64 | protected $context = self::CONTEXT_WEB; |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | return isset($this->previous); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Retrieves the information on the previous exception. |
|
| 119 | - * |
|
| 120 | - * NOTE: Throws an exception if there is no previous |
|
| 121 | - * exception. Use hasPrevious() first to avoid this. |
|
| 122 | - * |
|
| 123 | - * @throws ConvertHelper_Exception |
|
| 124 | - * @return ConvertHelper_ThrowableInfo |
|
| 125 | - * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION |
|
| 126 | - */ |
|
| 117 | + /** |
|
| 118 | + * Retrieves the information on the previous exception. |
|
| 119 | + * |
|
| 120 | + * NOTE: Throws an exception if there is no previous |
|
| 121 | + * exception. Use hasPrevious() first to avoid this. |
|
| 122 | + * |
|
| 123 | + * @throws ConvertHelper_Exception |
|
| 124 | + * @return ConvertHelper_ThrowableInfo |
|
| 125 | + * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION |
|
| 126 | + */ |
|
| 127 | 127 | public function getPrevious() : ConvertHelper_ThrowableInfo |
| 128 | 128 | { |
| 129 | 129 | if(isset($this->previous)) { |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | return !empty($this->code); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Improved textonly exception trace. |
|
| 147 | - */ |
|
| 145 | + /** |
|
| 146 | + * Improved textonly exception trace. |
|
| 147 | + */ |
|
| 148 | 148 | public function toString() : string |
| 149 | 149 | { |
| 150 | 150 | $calls = $this->getCalls(); |
@@ -172,73 +172,73 @@ discard block |
||
| 172 | 172 | return $string; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * Retrieves the URL of the page in which the exception |
|
| 177 | - * was thrown, if applicable: in CLI context, this will |
|
| 178 | - * return an empty string. |
|
| 179 | - * |
|
| 180 | - * @return string |
|
| 181 | - */ |
|
| 175 | + /** |
|
| 176 | + * Retrieves the URL of the page in which the exception |
|
| 177 | + * was thrown, if applicable: in CLI context, this will |
|
| 178 | + * return an empty string. |
|
| 179 | + * |
|
| 180 | + * @return string |
|
| 181 | + */ |
|
| 182 | 182 | public function getReferer() : string |
| 183 | 183 | { |
| 184 | 184 | return $this->referer; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * Whether the exception occurred in a command line context. |
|
| 189 | - * @return bool |
|
| 190 | - */ |
|
| 187 | + /** |
|
| 188 | + * Whether the exception occurred in a command line context. |
|
| 189 | + * @return bool |
|
| 190 | + */ |
|
| 191 | 191 | public function isCommandLine() : bool |
| 192 | 192 | { |
| 193 | 193 | return $this->getContext() === self::CONTEXT_COMMAND_LINE; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - /** |
|
| 197 | - * Whether the exception occurred during an http request. |
|
| 198 | - * @return bool |
|
| 199 | - */ |
|
| 196 | + /** |
|
| 197 | + * Whether the exception occurred during an http request. |
|
| 198 | + * @return bool |
|
| 199 | + */ |
|
| 200 | 200 | public function isWebRequest() : bool |
| 201 | 201 | { |
| 202 | 202 | return $this->getContext() === self::CONTEXT_WEB; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - /** |
|
| 206 | - * Retrieves the context identifier, i.e. if the exception |
|
| 207 | - * occurred in a command line context or regular web request. |
|
| 208 | - * |
|
| 209 | - * @return string |
|
| 210 | - * |
|
| 211 | - * @see ConvertHelper_ThrowableInfo::isCommandLine() |
|
| 212 | - * @see ConvertHelper_ThrowableInfo::isWebRequest() |
|
| 213 | - * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE |
|
| 214 | - * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB |
|
| 215 | - */ |
|
| 205 | + /** |
|
| 206 | + * Retrieves the context identifier, i.e. if the exception |
|
| 207 | + * occurred in a command line context or regular web request. |
|
| 208 | + * |
|
| 209 | + * @return string |
|
| 210 | + * |
|
| 211 | + * @see ConvertHelper_ThrowableInfo::isCommandLine() |
|
| 212 | + * @see ConvertHelper_ThrowableInfo::isWebRequest() |
|
| 213 | + * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE |
|
| 214 | + * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB |
|
| 215 | + */ |
|
| 216 | 216 | public function getContext() : string |
| 217 | 217 | { |
| 218 | 218 | return $this->context; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * Retrieves the date of the exception, and approximate time: |
|
| 223 | - * since exceptions do not store time, this is captured the |
|
| 224 | - * moment the ThrowableInfo is created. |
|
| 225 | - * |
|
| 226 | - * @return DateTime |
|
| 227 | - */ |
|
| 221 | + /** |
|
| 222 | + * Retrieves the date of the exception, and approximate time: |
|
| 223 | + * since exceptions do not store time, this is captured the |
|
| 224 | + * moment the ThrowableInfo is created. |
|
| 225 | + * |
|
| 226 | + * @return DateTime |
|
| 227 | + */ |
|
| 228 | 228 | public function getDate() : DateTime |
| 229 | 229 | { |
| 230 | 230 | return $this->date; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - /** |
|
| 234 | - * Serializes all information on the exception to an |
|
| 235 | - * associative array. This can be saved (file, database, |
|
| 236 | - * session...), and later be restored into a throwable |
|
| 237 | - * info instance using the fromSerialized() method. |
|
| 238 | - * |
|
| 239 | - * @return array<string,mixed> |
|
| 240 | - * @see ConvertHelper_ThrowableInfo::fromSerialized() |
|
| 241 | - */ |
|
| 233 | + /** |
|
| 234 | + * Serializes all information on the exception to an |
|
| 235 | + * associative array. This can be saved (file, database, |
|
| 236 | + * session...), and later be restored into a throwable |
|
| 237 | + * info instance using the fromSerialized() method. |
|
| 238 | + * |
|
| 239 | + * @return array<string,mixed> |
|
| 240 | + * @see ConvertHelper_ThrowableInfo::fromSerialized() |
|
| 241 | + */ |
|
| 242 | 242 | public function serialize() : array |
| 243 | 243 | { |
| 244 | 244 | $result = array( |
@@ -265,24 +265,24 @@ discard block |
||
| 265 | 265 | return $result; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - /** |
|
| 269 | - * Sets the maximum folder depth to show in the |
|
| 270 | - * file paths, to avoid them being too long. |
|
| 271 | - * |
|
| 272 | - * @param int $depth |
|
| 273 | - * @return ConvertHelper_ThrowableInfo |
|
| 274 | - */ |
|
| 268 | + /** |
|
| 269 | + * Sets the maximum folder depth to show in the |
|
| 270 | + * file paths, to avoid them being too long. |
|
| 271 | + * |
|
| 272 | + * @param int $depth |
|
| 273 | + * @return ConvertHelper_ThrowableInfo |
|
| 274 | + */ |
|
| 275 | 275 | public function setFolderDepth(int $depth) : ConvertHelper_ThrowableInfo |
| 276 | 276 | { |
| 277 | 277 | return $this->setOption('folder-depth', $depth); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - /** |
|
| 281 | - * Retrieves the current folder depth option value. |
|
| 282 | - * |
|
| 283 | - * @return int |
|
| 284 | - * @see ConvertHelper_ThrowableInfo::setFolderDepth() |
|
| 285 | - */ |
|
| 280 | + /** |
|
| 281 | + * Retrieves the current folder depth option value. |
|
| 282 | + * |
|
| 283 | + * @return int |
|
| 284 | + * @see ConvertHelper_ThrowableInfo::setFolderDepth() |
|
| 285 | + */ |
|
| 286 | 286 | public function getFolderDepth() : int |
| 287 | 287 | { |
| 288 | 288 | $depth = $this->getOption('folder-depth'); |
@@ -293,13 +293,13 @@ discard block |
||
| 293 | 293 | return 2; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - /** |
|
| 297 | - * Retrieves all function calls that led to the error, |
|
| 298 | - * ordered from latest to earliest (the first one in |
|
| 299 | - * the stack is actually the last call). |
|
| 300 | - * |
|
| 301 | - * @return ConvertHelper_ThrowableInfo_Call[] |
|
| 302 | - */ |
|
| 296 | + /** |
|
| 297 | + * Retrieves all function calls that led to the error, |
|
| 298 | + * ordered from latest to earliest (the first one in |
|
| 299 | + * the stack is actually the last call). |
|
| 300 | + * |
|
| 301 | + * @return ConvertHelper_ThrowableInfo_Call[] |
|
| 302 | + */ |
|
| 303 | 303 | public function getCalls() |
| 304 | 304 | { |
| 305 | 305 | return $this->calls; |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | return $this->calls[0]; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - /** |
|
| 319 | - * Returns the amount of function and method calls in the stack trace. |
|
| 320 | - * @return int |
|
| 321 | - */ |
|
| 318 | + /** |
|
| 319 | + * Returns the amount of function and method calls in the stack trace. |
|
| 320 | + * @return int |
|
| 321 | + */ |
|
| 322 | 322 | public function countCalls() : int |
| 323 | 323 | { |
| 324 | 324 | return $this->callsCount; |
@@ -210,12 +210,10 @@ |
||
| 210 | 210 | if($length === 3) |
| 211 | 211 | { |
| 212 | 212 | return self::parseHEX3($hex); |
| 213 | - } |
|
| 214 | - else if($length === 6) |
|
| 213 | + } else if($length === 6) |
|
| 215 | 214 | { |
| 216 | 215 | return self::parseHEX6($hex); |
| 217 | - } |
|
| 218 | - else if ($length === 8) |
|
| 216 | + } else if ($length === 8) |
|
| 219 | 217 | { |
| 220 | 218 | return self::parseHEX8($hex); |
| 221 | 219 | } |