| Conditions | 5 |
| Paths | 7 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 300 | public function get() { |
|
| 36 | 300 | if (!$this->timeZone) { |
|
| 37 | 300 | $net = $this->system->getNetPath(); |
|
| 38 | 300 | if ($net) { |
|
| 39 | 292 | $command = sprintf('%s time zone -S %s', |
|
| 40 | 292 | $net, |
|
| 41 | 292 | escapeshellarg($this->host) |
|
| 42 | 1 | ); |
|
| 43 | 292 | $this->timeZone = exec($command); |
|
| 44 | 1 | } |
|
| 45 | 300 | if (!$this->timeZone) { // fallback to server timezone |
|
| 46 | 8 | $date = $this->system->getDatePath(); |
|
| 47 | 8 | if ($date) { |
|
| 48 | 4 | $this->timeZone = exec($date . " +%z"); |
|
| 49 | 1 | } else { |
|
| 50 | 4 | $this->timeZone = date_default_timezone_get(); |
|
| 51 | } |
||
| 52 | 2 | } |
|
| 53 | 3 | } |
|
| 54 | 300 | return $this->timeZone; |
|
| 55 | } |
||
| 56 | } |
||
| 57 |