@@ -30,48 +30,48 @@ discard block |
||
| 30 | 30 | const SERIALIZED_OPTIONS = 'options'; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * @var Throwable |
|
| 34 | - */ |
|
| 33 | + * @var Throwable |
|
| 34 | + */ |
|
| 35 | 35 | protected $exception; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var ConvertHelper_ThrowableInfo_Call[] |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var ConvertHelper_ThrowableInfo_Call[] |
|
| 39 | + */ |
|
| 40 | 40 | protected $calls = array(); |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var integer |
|
| 44 | - */ |
|
| 42 | + /** |
|
| 43 | + * @var integer |
|
| 44 | + */ |
|
| 45 | 45 | protected $code = 0; |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var string |
|
| 49 | - */ |
|
| 47 | + /** |
|
| 48 | + * @var string |
|
| 49 | + */ |
|
| 50 | 50 | protected $message; |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var integer |
|
| 54 | - */ |
|
| 52 | + /** |
|
| 53 | + * @var integer |
|
| 54 | + */ |
|
| 55 | 55 | protected $callsCount = 0; |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @var ConvertHelper_ThrowableInfo |
|
| 59 | - */ |
|
| 57 | + /** |
|
| 58 | + * @var ConvertHelper_ThrowableInfo |
|
| 59 | + */ |
|
| 60 | 60 | protected $previous; |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @var string |
|
| 64 | - */ |
|
| 62 | + /** |
|
| 63 | + * @var string |
|
| 64 | + */ |
|
| 65 | 65 | protected $referer = ''; |
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @var Microtime |
|
| 69 | - */ |
|
| 67 | + /** |
|
| 68 | + * @var Microtime |
|
| 69 | + */ |
|
| 70 | 70 | protected $date; |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @var string |
|
| 74 | - */ |
|
| 72 | + /** |
|
| 73 | + * @var string |
|
| 74 | + */ |
|
| 75 | 75 | protected $context = self::CONTEXT_WEB; |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -125,16 +125,16 @@ discard block |
||
| 125 | 125 | return isset($this->previous); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Retrieves the information on the previous exception. |
|
| 130 | - * |
|
| 131 | - * NOTE: Throws an exception if there is no previous |
|
| 132 | - * exception. Use hasPrevious() first to avoid this. |
|
| 133 | - * |
|
| 134 | - * @throws ConvertHelper_Exception |
|
| 135 | - * @return ConvertHelper_ThrowableInfo |
|
| 136 | - * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION |
|
| 137 | - */ |
|
| 128 | + /** |
|
| 129 | + * Retrieves the information on the previous exception. |
|
| 130 | + * |
|
| 131 | + * NOTE: Throws an exception if there is no previous |
|
| 132 | + * exception. Use hasPrevious() first to avoid this. |
|
| 133 | + * |
|
| 134 | + * @throws ConvertHelper_Exception |
|
| 135 | + * @return ConvertHelper_ThrowableInfo |
|
| 136 | + * @see ConvertHelper_ThrowableInfo::ERROR_NO_PREVIOUS_EXCEPTION |
|
| 137 | + */ |
|
| 138 | 138 | public function getPrevious() : ConvertHelper_ThrowableInfo |
| 139 | 139 | { |
| 140 | 140 | if(isset($this->previous)) { |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | return !empty($this->code); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Improved text-only exception trace. |
|
| 158 | - */ |
|
| 156 | + /** |
|
| 157 | + * Improved text-only exception trace. |
|
| 158 | + */ |
|
| 159 | 159 | public function toString() : string |
| 160 | 160 | { |
| 161 | 161 | $calls = $this->getCalls(); |
@@ -183,73 +183,73 @@ discard block |
||
| 183 | 183 | return $string; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * Retrieves the URL of the page in which the exception |
|
| 188 | - * was thrown, if applicable: in CLI context, this will |
|
| 189 | - * return an empty string. |
|
| 190 | - * |
|
| 191 | - * @return string |
|
| 192 | - */ |
|
| 186 | + /** |
|
| 187 | + * Retrieves the URL of the page in which the exception |
|
| 188 | + * was thrown, if applicable: in CLI context, this will |
|
| 189 | + * return an empty string. |
|
| 190 | + * |
|
| 191 | + * @return string |
|
| 192 | + */ |
|
| 193 | 193 | public function getReferer() : string |
| 194 | 194 | { |
| 195 | 195 | return $this->referer; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Whether the exception occurred in a command line context. |
|
| 200 | - * @return bool |
|
| 201 | - */ |
|
| 198 | + /** |
|
| 199 | + * Whether the exception occurred in a command line context. |
|
| 200 | + * @return bool |
|
| 201 | + */ |
|
| 202 | 202 | public function isCommandLine() : bool |
| 203 | 203 | { |
| 204 | 204 | return $this->getContext() === self::CONTEXT_COMMAND_LINE; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * Whether the exception occurred during an http request. |
|
| 209 | - * @return bool |
|
| 210 | - */ |
|
| 207 | + /** |
|
| 208 | + * Whether the exception occurred during an http request. |
|
| 209 | + * @return bool |
|
| 210 | + */ |
|
| 211 | 211 | public function isWebRequest() : bool |
| 212 | 212 | { |
| 213 | 213 | return $this->getContext() === self::CONTEXT_WEB; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * Retrieves the context identifier, i.e. if the exception |
|
| 218 | - * occurred in a command line context or regular web request. |
|
| 219 | - * |
|
| 220 | - * @return string |
|
| 221 | - * |
|
| 222 | - * @see ConvertHelper_ThrowableInfo::isCommandLine() |
|
| 223 | - * @see ConvertHelper_ThrowableInfo::isWebRequest() |
|
| 224 | - * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE |
|
| 225 | - * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB |
|
| 226 | - */ |
|
| 216 | + /** |
|
| 217 | + * Retrieves the context identifier, i.e. if the exception |
|
| 218 | + * occurred in a command line context or regular web request. |
|
| 219 | + * |
|
| 220 | + * @return string |
|
| 221 | + * |
|
| 222 | + * @see ConvertHelper_ThrowableInfo::isCommandLine() |
|
| 223 | + * @see ConvertHelper_ThrowableInfo::isWebRequest() |
|
| 224 | + * @see ConvertHelper_ThrowableInfo::CONTEXT_COMMAND_LINE |
|
| 225 | + * @see ConvertHelper_ThrowableInfo::CONTEXT_WEB |
|
| 226 | + */ |
|
| 227 | 227 | public function getContext() : string |
| 228 | 228 | { |
| 229 | 229 | return $this->context; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - /** |
|
| 233 | - * Retrieves the date of the exception, and approximate time: |
|
| 234 | - * since exceptions do not store time, this is captured the |
|
| 235 | - * moment the ThrowableInfo is created. |
|
| 236 | - * |
|
| 237 | - * @return Microtime |
|
| 238 | - */ |
|
| 232 | + /** |
|
| 233 | + * Retrieves the date of the exception, and approximate time: |
|
| 234 | + * since exceptions do not store time, this is captured the |
|
| 235 | + * moment the ThrowableInfo is created. |
|
| 236 | + * |
|
| 237 | + * @return Microtime |
|
| 238 | + */ |
|
| 239 | 239 | public function getDate() : Microtime |
| 240 | 240 | { |
| 241 | 241 | return $this->date; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - /** |
|
| 245 | - * Serializes all information on the exception to an |
|
| 246 | - * associative array. This can be saved (file, database, |
|
| 247 | - * session...), and later be restored into a throwable |
|
| 248 | - * info instance using the fromSerialized() method. |
|
| 249 | - * |
|
| 250 | - * @return array<string,mixed> |
|
| 251 | - * @see ConvertHelper_ThrowableInfo::fromSerialized() |
|
| 252 | - */ |
|
| 244 | + /** |
|
| 245 | + * Serializes all information on the exception to an |
|
| 246 | + * associative array. This can be saved (file, database, |
|
| 247 | + * session...), and later be restored into a throwable |
|
| 248 | + * info instance using the fromSerialized() method. |
|
| 249 | + * |
|
| 250 | + * @return array<string,mixed> |
|
| 251 | + * @see ConvertHelper_ThrowableInfo::fromSerialized() |
|
| 252 | + */ |
|
| 253 | 253 | public function serialize() : array |
| 254 | 254 | { |
| 255 | 255 | $result = array( |
@@ -276,24 +276,24 @@ discard block |
||
| 276 | 276 | return $result; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - /** |
|
| 280 | - * Sets the maximum folder depth to show in the |
|
| 281 | - * file paths, to avoid them being too long. |
|
| 282 | - * |
|
| 283 | - * @param int $depth |
|
| 284 | - * @return ConvertHelper_ThrowableInfo |
|
| 285 | - */ |
|
| 279 | + /** |
|
| 280 | + * Sets the maximum folder depth to show in the |
|
| 281 | + * file paths, to avoid them being too long. |
|
| 282 | + * |
|
| 283 | + * @param int $depth |
|
| 284 | + * @return ConvertHelper_ThrowableInfo |
|
| 285 | + */ |
|
| 286 | 286 | public function setFolderDepth(int $depth) : ConvertHelper_ThrowableInfo |
| 287 | 287 | { |
| 288 | 288 | return $this->setOption('folder-depth', $depth); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - /** |
|
| 292 | - * Retrieves the current folder depth option value. |
|
| 293 | - * |
|
| 294 | - * @return int |
|
| 295 | - * @see ConvertHelper_ThrowableInfo::setFolderDepth() |
|
| 296 | - */ |
|
| 291 | + /** |
|
| 292 | + * Retrieves the current folder depth option value. |
|
| 293 | + * |
|
| 294 | + * @return int |
|
| 295 | + * @see ConvertHelper_ThrowableInfo::setFolderDepth() |
|
| 296 | + */ |
|
| 297 | 297 | public function getFolderDepth() : int |
| 298 | 298 | { |
| 299 | 299 | $depth = $this->getOption('folder-depth'); |
@@ -304,13 +304,13 @@ discard block |
||
| 304 | 304 | return 2; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - /** |
|
| 308 | - * Retrieves all function calls that led to the error, |
|
| 309 | - * ordered from latest to earliest (the first one in |
|
| 310 | - * the stack is actually the last call). |
|
| 311 | - * |
|
| 312 | - * @return ConvertHelper_ThrowableInfo_Call[] |
|
| 313 | - */ |
|
| 307 | + /** |
|
| 308 | + * Retrieves all function calls that led to the error, |
|
| 309 | + * ordered from latest to earliest (the first one in |
|
| 310 | + * the stack is actually the last call). |
|
| 311 | + * |
|
| 312 | + * @return ConvertHelper_ThrowableInfo_Call[] |
|
| 313 | + */ |
|
| 314 | 314 | public function getCalls() |
| 315 | 315 | { |
| 316 | 316 | return $this->calls; |
@@ -326,10 +326,10 @@ discard block |
||
| 326 | 326 | return $this->calls[0]; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - /** |
|
| 330 | - * Returns the amount of function and method calls in the stack trace. |
|
| 331 | - * @return int |
|
| 332 | - */ |
|
| 329 | + /** |
|
| 330 | + * Returns the amount of function and method calls in the stack trace. |
|
| 331 | + * @return int |
|
| 332 | + */ |
|
| 333 | 333 | public function countCalls() : int |
| 334 | 334 | { |
| 335 | 335 | return $this->callsCount; |