| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 9 | private function getInfoFromData($data): array |
|
| 17 | { |
||
| 18 | 9 | $timestamp = $data['timestamp'] ?? null; |
|
| 19 | |||
| 20 | try { |
||
| 21 | 9 | if ($timestamp !== null && !($timestamp instanceof \DateTimeInterface)) { |
|
| 22 | 9 | $timestamp = new \DateTimeImmutable('@' . $data['timestamp']); |
|
| 23 | } |
||
| 24 | 1 | } catch (\Throwable $exception) { |
|
| 25 | 1 | trigger_error($exception->getMessage(), E_USER_WARNING); |
|
| 26 | 1 | $timestamp = null; |
|
| 27 | } |
||
| 28 | |||
| 29 | return [ |
||
| 30 | 9 | 'user' => $data['user'] ?? null, |
|
| 31 | 9 | 'context' => $data['context'] ?? null, |
|
| 32 | 9 | 'checksum' => $data['checksum'] ?? null, |
|
| 33 | 9 | 'timestamp' => $timestamp, |
|
| 34 | ]; |
||
| 37 |