| Conditions | 6 |
| Paths | 7 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 436 | public function get() { |
|
| 36 | 436 | if (!$this->timeZone) { |
|
| 37 | 436 | $net = $this->system->getNetPath(); |
|
| 38 | // for local domain names we can assume same timezone |
||
| 39 | 436 | if ($net && strpos($this->host, '.') !== false) { |
|
| 40 | 4 | $command = sprintf('%s time zone -S %s', |
|
| 41 | 4 | $net, |
|
| 42 | 4 | escapeshellarg($this->host) |
|
| 43 | 1 | ); |
|
| 44 | 4 | $this->timeZone = exec($command); |
|
| 45 | 1 | } |
|
| 46 | 436 | if (!$this->timeZone) { // fallback to server timezone |
|
| 47 | 432 | $date = $this->system->getDatePath(); |
|
| 48 | 432 | if ($date) { |
|
| 49 | 428 | $this->timeZone = exec($date . " +%z"); |
|
| 50 | 107 | } else { |
|
| 51 | 4 | $this->timeZone = date_default_timezone_get(); |
|
| 52 | } |
||
| 53 | 108 | } |
|
| 54 | 109 | } |
|
| 55 | 436 | return $this->timeZone; |
|
| 56 | } |
||
| 57 | } |
||
| 58 |