| Conditions | 5 |
| Paths | 16 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | protected function checkSSHConnection($server = null, $ssh_config_file = null, $verbose = false) |
||
| 51 | { |
||
| 52 | $server = $server ? $server : $this->hostNameForConfigFile(); |
||
| 53 | $ssh_config_file = $ssh_config_file ? $ssh_config_file : $this->sshConfigFile(); |
||
| 54 | if ($verbose) { |
||
| 55 | $this->info("timeout 10 ssh -F $ssh_config_file -q " . $server . ' exit; echo $?'); |
||
| 56 | } |
||
| 57 | |||
| 58 | $ret = exec("timeout 10 ssh -F $ssh_config_file -q " . $server . ' "exit"; echo $?'); |
||
| 59 | if ($ret == 0) { |
||
| 60 | return true; |
||
| 61 | } |
||
| 62 | return false; |
||
| 63 | } |
||
| 64 | |||
| 79 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: