Conditions | 5 |
Paths | 7 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 19 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
35 | 12 | public function get() { |
|
36 | 12 | if (!$this->timeZone) { |
|
37 | 12 | $net = $this->system->getNetPath(); |
|
38 | 12 | if ($net) { |
|
39 | 4 | $command = sprintf('%s time zone -S %s', |
|
40 | 4 | $net, |
|
41 | 4 | escapeshellarg($this->host) |
|
42 | 1 | ); |
|
43 | 4 | $this->timeZone = exec($command); |
|
44 | 1 | } |
|
45 | 12 | 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 | 12 | return $this->timeZone; |
|
55 | } |
||
56 | } |
||
57 |