Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 9 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
59 | View Code Duplication | protected function execSSH($command, $server = null) |
|
60 | { |
||
61 | $server = $server ? $server : $this->hostNameForConfigFile(); |
||
62 | |||
63 | $ssh_config_file = $_SERVER['HOME'] . '/.ssh/config'; |
||
64 | $full_command = "ssh -F $ssh_config_file -t $server '$command'"; |
||
65 | $this->info($full_command); |
||
66 | return shell_exec($full_command); |
||
67 | } |
||
68 | } |
||
69 |
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: