Conditions | 6 |
Paths | 4 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 14.2156 |
Changes | 0 |
1 | <?php |
||
28 | 1024 | public function get($host) { |
|
29 | 1024 | if (!isset($this->timeZones[$host])) { |
|
30 | 1024 | $net = $this->system->getNetPath(); |
|
31 | // for local domain names we can assume same timezone |
||
32 | 1024 | 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 | 1024 | $this->timeZones[$host] = date_default_timezone_get(); |
|
45 | } |
||
46 | 256 | } |
|
47 | 1024 | return $this->timeZones[$host]; |
|
48 | } |
||
49 | } |
||
50 |