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