| Conditions | 6 |
| Paths | 4 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 14.2156 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 512 | public function get($host) { |
|
| 29 | 512 | if (!isset($this->timeZones[$host])) { |
|
| 30 | 512 | $net = $this->system->getNetPath(); |
|
| 31 | // for local domain names we can assume same timezone |
||
| 32 | 512 | if ($net && $host && strpos($host, '.') !== false) { |
|
| 33 | $command = sprintf( |
||
| 34 | '%s time zone -S %s', |
||
| 35 | $net, |
||
| 36 | escapeshellarg($host) |
||
| 37 | ); |
||
| 38 | $timeZone = exec($command); |
||
| 39 | if (!$timeZone) { |
||
| 40 | $timeZone = date_default_timezone_get(); |
||
| 41 | } |
||
| 42 | $this->timeZones[$host] = $timeZone; |
||
| 43 | } else { // fallback to server timezone |
||
| 44 | 512 | $this->timeZones[$host] = date_default_timezone_get(); |
|
| 45 | } |
||
| 46 | 256 | } |
|
| 47 | 512 | return $this->timeZones[$host]; |
|
| 48 | } |
||
| 49 | } |
||
| 50 |