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