| 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 |
||
| 10 | 2 | public function getCreatedDateTime(string $timezone = 'America/New_York') : ?DateTime { |
|
| 11 | |||
| 12 | // Check if 'CreatedDateTime' is present in the extra args |
||
| 13 | 2 | if (!isset($this->extraArgs()['CreatedDateTime'])) { |
|
| 14 | 1 | return null; // or throw an exception if required |
|
| 15 | } |
||
| 16 | |||
| 17 | try { |
||
| 18 | 1 | $createdDateTime = new DateTime($this->extraArgs()['CreatedDateTime'], new DateTimeZone($timezone)); |
|
| 19 | |||
| 20 | 1 | return $createdDateTime; |
|
| 21 | } catch (\Exception $e) { |
||
| 22 | return null; |
||
| 23 | } |
||
| 67 | } |