| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5.6359 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 768 | public function get($host) { |
|
| 29 | 768 | if (!isset($this->timeZones[$host])) { |
|
| 30 | 768 | $net = $this->system->getNetPath(); |
|
| 31 | 768 | if ($net && $host) { |
|
| 32 | 768 | $command = sprintf('%s time zone -S %s', |
|
| 33 | 768 | $net, |
|
| 34 | 768 | escapeshellarg($host) |
|
| 35 | ); |
||
| 36 | 768 | $timeZone = exec($command); |
|
| 37 | 768 | if (!$timeZone) { |
|
| 38 | 3 | $timeZone = date_default_timezone_get(); |
|
| 39 | } |
||
| 40 | 768 | $this->timeZones[$host] = $timeZone; |
|
| 41 | } else { // fallback to server timezone |
||
| 42 | $this->timeZones[$host] = date_default_timezone_get(); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | 768 | return $this->timeZones[$host]; |
|
| 46 | } |
||
| 47 | } |
||
| 48 |