Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.2098 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | 2 | public function getCreatedDateTime(string $timezone = 'America/New_York') : ?DateTime { |
|
12 | |||
13 | // Check if 'CreatedDateTime' is present in the extra args |
||
14 | 2 | if (!isset($this->extraArgs()['CreatedDateTime'])) { |
|
15 | 1 | return null; // or throw an exception if required |
|
16 | } |
||
17 | |||
18 | try { |
||
19 | 1 | $createdDateTime = new DateTime($this->extraArgs()['CreatedDateTime'], new DateTimeZone($timezone)); |
|
20 | |||
21 | 1 | return $createdDateTime; |
|
22 | } catch (Throwable $e) { |
||
23 | return null; |
||
24 | } |
||
68 | } |