| Total Complexity | 6 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait HasTimezone |
||
| 6 | { |
||
| 7 | public function getTimezone(): ?string |
||
| 8 | { |
||
| 9 | $timezone = $this->timezone; |
||
| 10 | if ($timezone === null) { |
||
| 11 | return null; |
||
| 12 | } |
||
| 13 | |||
| 14 | return (string) $timezone; |
||
| 15 | } |
||
| 16 | |||
| 17 | public function getDetectTimezone(): ?bool |
||
| 18 | { |
||
| 19 | $detectTimezone = $this->detect_timezone; |
||
| 20 | if ($detectTimezone === null) { |
||
| 21 | return null; |
||
| 22 | } |
||
| 23 | |||
| 24 | return (bool) $detectTimezone; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function setTimezone(?string $timezone) |
||
| 28 | { |
||
| 29 | $this->timezone = $timezone; |
||
|
|
|||
| 30 | |||
| 31 | return $this; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function setDetectTimezone(?bool $detectTimezone) |
||
| 39 | } |
||
| 40 | } |
||
| 41 |