@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $this->config = array_merge($this->config, $config ?: []); |
| 597 | 597 | |
| 598 | 598 | $this->setOptions($this->config[self::CONF_OPTIONS]) |
| 599 | - ->setSSH($this->config[self::CONF_SSH]); |
|
| 599 | + ->setSSH($this->config[self::CONF_SSH]); |
|
| 600 | 600 | |
| 601 | 601 | parent::__construct($this->config[self::CONF_EXECUTABLE], $this->config[self::CONF_CWD], '='); |
| 602 | 602 | } |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | |
| 647 | 647 | $this->setParameters([$from, $to]); |
| 648 | 648 | $this->execute() |
| 649 | - ->clearParameters(); |
|
| 649 | + ->clearParameters(); |
|
| 650 | 650 | |
| 651 | 651 | return $this; |
| 652 | 652 | } |
@@ -601,7 +601,7 @@ |
||
| 601 | 601 | parent::__construct($this->config[self::CONF_EXECUTABLE], $this->config[self::CONF_CWD], '='); |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - public function getSSH() :?SSH { |
|
| 604 | + public function getSSH() : ?SSH { |
|
| 605 | 605 | return $this->config[self::CONF_SSH]; |
| 606 | 606 | } |
| 607 | 607 | |
@@ -628,14 +628,11 @@ |
||
| 628 | 628 | public function setSSH($ssh) :self { |
| 629 | 629 | if ($ssh instanceof SSH) { |
| 630 | 630 | $this->config[self::CONF_SSH] = $ssh; |
| 631 | - } |
|
| 632 | - else if (is_array($ssh)) { |
|
| 631 | + } else if (is_array($ssh)) { |
|
| 633 | 632 | $this->config[self::CONF_SSH] = new SSH($ssh); |
| 634 | - } |
|
| 635 | - else if ($ssh === null) { |
|
| 633 | + } else if ($ssh === null) { |
|
| 636 | 634 | $this->config[self::CONF_SSH] = null; |
| 637 | - } |
|
| 638 | - else { |
|
| 635 | + } else { |
|
| 639 | 636 | throw new Exception\Command('ssh config has to be an instance of \xobotyi\rsync\SSH, array or null, got ' . gettype($ssh)); |
| 640 | 637 | } |
| 641 | 638 | |
@@ -63,8 +63,8 @@ |
||
| 63 | 63 | */ |
| 64 | 64 | public function __construct(string $executable, string $cwd = './', string $optionValueAssigner = ' ') { |
| 65 | 65 | $this->setExecutable($executable) |
| 66 | - ->setCWD($cwd) |
|
| 67 | - ->setOptionValueAssigner($optionValueAssigner); |
|
| 66 | + ->setCWD($cwd) |
|
| 67 | + ->setOptionValueAssigner($optionValueAssigner); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | * @throws \xobotyi\rsync\Exception\Command |
| 107 | 107 | */ |
| 108 | 108 | public function execute() :self { |
| 109 | - $this->exitCode = 1; // exit 0 on ok |
|
| 110 | - $this->stdout = ''; // output of the command |
|
| 111 | - $this->stderr = ''; // errors during execution |
|
| 109 | + $this->exitCode = 1; // exit 0 on ok |
|
| 110 | + $this->stdout = ''; // output of the command |
|
| 111 | + $this->stderr = ''; // errors during execution |
|
| 112 | 112 | |
| 113 | 113 | $descriptor = [ |
| 114 | - 0 => ["pipe", "r"], // stdin is a pipe that the child will read from |
|
| 115 | - 1 => ["pipe", "w"], // stdout is a pipe that the child will write to |
|
| 114 | + 0 => ["pipe", "r"], // stdin is a pipe that the child will read from |
|
| 115 | + 1 => ["pipe", "w"], // stdout is a pipe that the child will write to |
|
| 116 | 116 | 2 => ["pipe", "w"] // stderr is a pipe |
| 117 | 117 | ]; |
| 118 | 118 | |
@@ -260,21 +260,21 @@ discard block |
||
| 260 | 260 | /** |
| 261 | 261 | * @return string|null |
| 262 | 262 | */ |
| 263 | - public function getExitCode() :?string { |
|
| 263 | + public function getExitCode() : ?string { |
|
| 264 | 264 | return $this->exitCode; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * @return string|null |
| 269 | 269 | */ |
| 270 | - public function getStdout() :?string { |
|
| 270 | + public function getStdout() : ?string { |
|
| 271 | 271 | return $this->stdout; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | 275 | * @return string|null |
| 276 | 276 | */ |
| 277 | - public function getStderr() :?string { |
|
| 277 | + public function getStderr() : ?string { |
|
| 278 | 278 | |
| 279 | 279 | return $this->stderr; |
| 280 | 280 | } |
@@ -369,8 +369,7 @@ |
||
| 369 | 369 | if (is_bool($val)) { |
| 370 | 370 | if ($val) { |
| 371 | 371 | $this->options[$optName] = $val; |
| 372 | - } |
|
| 373 | - else { |
|
| 372 | + } else { |
|
| 374 | 373 | unset($this->options[$optName]); |
| 375 | 374 | } |
| 376 | 375 | |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | use xobotyi\rsync; |
| 11 | 11 | |
| 12 | 12 | $ssh = new rsync\SSH([ |
| 13 | - rsync\SSH::CONF_EXECUTABLE => 'C:\rsync\ssh.exe', |
|
| 14 | - rsync\SSH::CONF_OPTIONS => [ |
|
| 15 | - rsync\SSH::OPT_IDENTIFICATION_FILE => __DIR__ . '/../tests/ident.txt', |
|
| 16 | - rsync\SSH::OPT_OPTION => ['BatchMode=yes', 'StrictHostKeyChecking=no'], |
|
| 17 | - ], |
|
| 18 | - ]); |
|
| 19 | 13 | \ No newline at end of file |
| 14 | + rsync\SSH::CONF_EXECUTABLE => 'C:\rsync\ssh.exe', |
|
| 15 | + rsync\SSH::CONF_OPTIONS => [ |
|
| 16 | + rsync\SSH::OPT_IDENTIFICATION_FILE => __DIR__ . '/../tests/ident.txt', |
|
| 17 | + rsync\SSH::OPT_OPTION => ['BatchMode=yes', 'StrictHostKeyChecking=no'], |
|
| 18 | + ], |
|
| 19 | + ]); |
|
| 20 | 20 | \ No newline at end of file |