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