Conditions | 3 |
Paths | 3 |
Total Lines | 8 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
24 | 44 | protected function setTime(string $attribute, string|int|null $value): void |
|
25 | { |
||
26 | 44 | if ($value !== null) { |
|
27 | // Workaround for amazon developer console sending unix timestamp |
||
28 | try { |
||
29 | 44 | $this->{$attribute} = new \DateTime((string) $value); |
|
30 | 14 | } catch (\Exception $e) { |
|
31 | 14 | $this->{$attribute} = (new \DateTime())->setTimestamp((int) ((string) ($value / 1000))); |
|
32 | } |
||
36 |