Conditions | 4 |
Paths | 8 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | protected function runScp($file, $destination_path, $server = null, $verbose = false) |
||
|
|||
22 | { |
||
23 | $recursive_option = ''; |
||
24 | if (is_dir($file)) { |
||
25 | $recursive_option = ' -r'; |
||
26 | } |
||
27 | $server = $server ? $server : $this->hostNameForConfigFile(); |
||
28 | $ssh_config_file = $_SERVER['HOME'] . '/.ssh/config'; |
||
29 | $full_command = "scp -F ${ssh_config_file}$recursive_option $file $server:$destination_path"; |
||
30 | |||
31 | if ($verbose) { |
||
32 | $this->info($full_command); |
||
33 | } |
||
34 | passthru($full_command); |
||
35 | } |
||
36 | |||
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: