Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.2098 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
55 | 2 | public function getStartDateTime(string $timezone = 'America/New_York'): ?\DateTime |
|
56 | { |
||
57 | // Check if 'StartDateTime' is present in the extra args |
||
58 | 2 | if (!isset($this->extraArgs()['StartDateTime'])) { |
|
59 | 1 | return null; // or throw an exception if required |
|
60 | } |
||
61 | |||
62 | try { |
||
63 | 1 | $startDateTime = new DateTime($this->extraArgs()['StartDateTime'], new DateTimeZone($timezone)); |
|
64 | |||
65 | 1 | return $startDateTime; |
|
66 | } catch (Throwable $e) { |
||
67 | return null; |
||
68 | } |
||
71 |