| Conditions | 1 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public static function createFromException(\Exception $exception) |
||
| 16 | { |
||
| 17 | $trace = $exception->getTrace(); |
||
| 18 | |||
| 19 | $error = new Error(); |
||
| 20 | $error->setId(self::generateRandomBitsInHex(self::ERROR_ID_SIZE)); |
||
| 21 | |||
| 22 | $errorException = new ErrorException(); |
||
| 23 | $errorException->setCode($exception->getCode()); |
||
| 24 | $errorException->setMessage($exception->getMessage()); |
||
| 25 | $errorException->setType(get_class($exception)); |
||
| 26 | $error->setException($errorException); |
||
| 27 | |||
| 28 | $error->setTimestamp(intval(round(microtime(true) * 1000000))); |
||
| 29 | $error->setCulprit($trace[0]['class'] . $trace[0]['type'] . $trace[0]['function']); |
||
| 30 | |||
| 31 | return $error; |
||
| 32 | } |
||
| 34 |