| Total Complexity | 11 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Coverage | 76% |
| Changes | 5 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 8 | class Season extends Base { |
||
| 9 | |||
| 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 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | 1 | public function getDescription(): string |
|
| 27 | { |
||
| 28 | 1 | return (string)$this->extraArgs()['Description']; |
|
| 29 | } |
||
| 30 | |||
| 31 | 2 | public function getEndDateTime(string $timezone = 'America/New_York') : ?DateTime |
|
| 32 | { |
||
| 33 | // Check if 'EndDateTime' is present in the extra args |
||
| 34 | 2 | if (!isset($this->extraArgs()['EndDateTime'])) { |
|
| 35 | 1 | return null; |
|
| 36 | } |
||
| 37 | |||
| 38 | try { |
||
| 39 | 1 | $endDateTime = new DateTime($this->extraArgs()['EndDateTime'], new DateTimeZone($timezone)); |
|
| 40 | |||
| 41 | 1 | return $endDateTime; |
|
| 42 | } catch (\Exception $e) { |
||
| 43 | return null; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | 1 | public function getId(): int |
|
| 50 | } |
||
| 51 | |||
| 52 | 2 | public function getStartDateTime(string $timezone = 'America/New_York') : ?\DateTime |
|
| 53 | { |
||
| 67 | } |