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