@@ -142,7 +142,7 @@ |
||
| 142 | 142 | $error = $ssh->get_error(); |
| 143 | 143 | $retval = $ssh->get_exitstatus(); |
| 144 | 144 | |
| 145 | - if ($strict && $retval != 0 ) |
|
| 145 | + if ($strict && $retval != 0) |
|
| 146 | 146 | { |
| 147 | 147 | throw new \RuntimeException($error); |
| 148 | 148 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ->write("export KRB5CCNAME=`mktemp /tmp/krb5cc_{$username}_XXXXXXXXXXXXX`;") |
| 58 | 58 | ->write($command) |
| 59 | 59 | ->write($this->configuration->get_password()) |
| 60 | - ->write('echo KRB5CCNAME:$KRB5CCNAME', true) |
|
| 60 | + ->write('echo KRB5CCNAME:$KRB5CCNAME', TRUE) |
|
| 61 | 61 | ->output(); |
| 62 | 62 | |
| 63 | 63 | if (!preg_match("/KRB5CCNAME:(\/tmp\/krb5cc_.*)/", $shell->get_output(), $matches)) |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param array $arguments klist command line arguments |
| 79 | 79 | * @return int return code (exit status code) |
| 80 | 80 | */ |
| 81 | - final public function kdestroy(array $options = [], array $arguments = [], $strict = true) |
|
| 81 | + final public function kdestroy(array $options = [], array $arguments = [], $strict = TRUE) |
|
| 82 | 82 | { |
| 83 | 83 | $command = (new Builder()) |
| 84 | 84 | ->setPrefix('kdestroy') |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param array $arguments klist command line arguments |
| 97 | 97 | * @return string klist results |
| 98 | 98 | */ |
| 99 | - final public function klist(array $options = [], array $arguments = [], $strict = true) |
|
| 99 | + final public function klist(array $options = [], array $arguments = [], $strict = TRUE) |
|
| 100 | 100 | { |
| 101 | 101 | $command = (new Builder()) |
| 102 | 102 | ->setPrefix('klist') |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param array $arguments kinit command line arguments |
| 118 | 118 | * @return int exit status code |
| 119 | 119 | */ |
| 120 | - final public function kinit(array $options = [], array $arguments = [], $strict = true) |
|
| 120 | + final public function kinit(array $options = [], array $arguments = [], $strict = TRUE) |
|
| 121 | 121 | { |
| 122 | 122 | $command = (new Builder()) |
| 123 | 123 | ->setPrefix('kinit') |
@@ -167,11 +167,11 @@ |
||
| 167 | 167 | $terminal->get_height() |
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | - if ($stream === false) |
|
| 170 | + if ($stream === FALSE) |
|
| 171 | 171 | { |
| 172 | 172 | throw new \RuntimeException($this->get_error_message()); |
| 173 | 173 | } |
| 174 | - stream_set_blocking($stream, true); |
|
| 174 | + stream_set_blocking($stream, TRUE); |
|
| 175 | 175 | return $stream; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | final public function shell() |
| 56 | 56 | { |
| 57 | - if (($this->stream = @ssh2_shell($this->connection)) === false) |
|
| 57 | + if (($this->stream = @ssh2_shell($this->connection)) === FALSE) |
|
| 58 | 58 | { |
| 59 | 59 | throw new \RuntimeException($this->get_error_message()); |
| 60 | 60 | } |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | * @param instance $terminal Terminal instance |
| 92 | 92 | * @return object |
| 93 | 93 | */ |
| 94 | - final public function write($command, $returncode = false) |
|
| 94 | + final public function write($command, $returncode = FALSE) |
|
| 95 | 95 | { |
| 96 | - $command = ($returncode == false) ? $command : $command . '; echo "RETURN_CODE:[$?]";'; |
|
| 96 | + $command = ($returncode == FALSE) ? $command : $command . '; echo "RETURN_CODE:[$?]";'; |
|
| 97 | 97 | $write_count = 0; |
| 98 | 98 | $string_len = strlen($command . PHP_EOL); |
| 99 | 99 | while ($write_count < $string_len) |
| 100 | 100 | { |
| 101 | 101 | $fwrite_count = fwrite($this->stream, substr($command . PHP_EOL, $write_count), 1024); |
| 102 | - if ($fwrite_count === false) |
|
| 102 | + if ($fwrite_count === FALSE) |
|
| 103 | 103 | { |
| 104 | 104 | throw new \RuntimeException('failed to write command to stream'); |
| 105 | 105 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | parent::__construct($configuration, $authentication); |
| 35 | 35 | |
| 36 | 36 | $this->sftp = @ssh2_sftp($this->connection); |
| 37 | - if(!$this->sftp) |
|
| 37 | + if (!$this->sftp) |
|
| 38 | 38 | { |
| 39 | 39 | throw new \RuntimeException($this->get_error_message()); |
| 40 | 40 | } |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | final public function copy($srcfile, $destfile) |
| 51 | 51 | { |
| 52 | - if ($this->is_file($srcfile) === false) |
|
| 52 | + if ($this->is_file($srcfile) === FALSE) |
|
| 53 | 53 | { |
| 54 | 54 | $this->set_error('Local file ' . $srcfile . ' does not exist.'); |
| 55 | 55 | $this->set_exitstatus(1); |
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (@copy($this->sftp_url($srcfile), $this->sftp_url($destfile)) === false) |
|
| 59 | + if (@copy($this->sftp_url($srcfile), $this->sftp_url($destfile)) === FALSE) |
|
| 60 | 60 | { |
| 61 | 61 | $this->set_error($this->get_error_message()); |
| 62 | 62 | $this->set_exitstatus(1); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | if ($this->is_file($file)) |
| 84 | 84 | { |
| 85 | - if (@unlink($this->sftp_url($file)) === false) |
|
| 85 | + if (@unlink($this->sftp_url($file)) === FALSE) |
|
| 86 | 86 | { |
| 87 | 87 | $this->set_error($this->get_error_message()); |
| 88 | 88 | $this->set_exitstatus(1); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $files = []; |
| 129 | 129 | if ($handle = @opendir($this->sftp_url($path))) |
| 130 | 130 | { |
| 131 | - while (($file = @readdir($handle)) !== false) |
|
| 131 | + while (($file = @readdir($handle)) !== FALSE) |
|
| 132 | 132 | { |
| 133 | 133 | if ($file != '.' && $file != '..') |
| 134 | 134 | { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $files['directories'][] = $filename; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ($this->is_dir($filename) === false) |
|
| 141 | + if ($this->is_dir($filename) === FALSE) |
|
| 142 | 142 | { |
| 143 | 143 | $files['files'][] = $filename; |
| 144 | 144 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | final public function glob($directory, $pattern = '') |
| 161 | 161 | { |
| 162 | - if ($this->is_dir($directory) == false) |
|
| 162 | + if ($this->is_dir($directory) == FALSE) |
|
| 163 | 163 | { |
| 164 | 164 | $this->set_error($this->get_error_message()); |
| 165 | 165 | $this->set_exitstatus(1); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $handle = opendir($this->sftp_url($directory)); |
| 170 | - while (($file = readdir($handle)) !== false) |
|
| 170 | + while (($file = readdir($handle)) !== FALSE) |
|
| 171 | 171 | { |
| 172 | 172 | $files[] = preg_grep('/(^.*' . $pattern . '.*$)/', explode(PHP_EOL, $file)); |
| 173 | 173 | } |
@@ -200,12 +200,12 @@ discard block |
||
| 200 | 200 | * @param int $chgrp change gid for directory |
| 201 | 201 | * @return bool |
| 202 | 202 | */ |
| 203 | - final public function mkdir($directories, $mode = 0777, $recursive = false) |
|
| 203 | + final public function mkdir($directories, $mode = 0777, $recursive = FALSE) |
|
| 204 | 204 | { |
| 205 | 205 | $directories = !is_array($directories) ? [$directories] : $directories; |
| 206 | 206 | foreach ($directories as $directory) |
| 207 | 207 | { |
| 208 | - if (@mkdir($this->sftp_url($directory), $mode, $recursive) === false) |
|
| 208 | + if (@mkdir($this->sftp_url($directory), $mode, $recursive) === FALSE) |
|
| 209 | 209 | { |
| 210 | 210 | $this->set_error($this->get_error_message()); |
| 211 | 211 | $this->set_exitstatus(1); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | final public function rename($oldfile, $newfile) |
| 227 | 227 | { |
| 228 | - if ($this->is_file($oldfile) === false) |
|
| 228 | + if ($this->is_file($oldfile) === FALSE) |
|
| 229 | 229 | { |
| 230 | 230 | $this->set_error('Local file ' . $oldfile . ' does not exist.'); |
| 231 | 231 | $this->set_exitstatus(1); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $files = array_key_exists('files', $stdout) ? $stdout['files'] : []; |
| 266 | 266 | if (count($files) == 0) |
| 267 | 267 | { |
| 268 | - if (@rmdir($this->sftp_url($directory)) === false) |
|
| 268 | + if (@rmdir($this->sftp_url($directory)) === FALSE) |
|
| 269 | 269 | { |
| 270 | 270 | $this->set_error($this->get_error_message()); |
| 271 | 271 | $this->set_exitstatus(1); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | { |
| 343 | 343 | $statinfo = ssh2_sftp_stat($this->sftp, $path); |
| 344 | 344 | |
| 345 | - if ($statinfo === false) |
|
| 345 | + if ($statinfo === FALSE) |
|
| 346 | 346 | { |
| 347 | 347 | $this->set_error($this->get_error_message()); |
| 348 | 348 | $this->set_exitstatus(0); |
@@ -95,8 +95,7 @@ |
||
| 95 | 95 | if (preg_match('/^-.*$/', $key, $matches)) |
| 96 | 96 | { |
| 97 | 97 | $this->arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
| 98 | - } |
|
| 99 | - else |
|
| 98 | + } else |
|
| 100 | 99 | { |
| 101 | 100 | $this->arguments[] = is_array($value) ? implode(' ', $value) : $value; |
| 102 | 101 | } |
@@ -16,42 +16,42 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @var string |
| 18 | 18 | */ |
| 19 | - protected $username = null; |
|
| 19 | + protected $username = NULL; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * User password. |
| 23 | 23 | * |
| 24 | 24 | * @var string |
| 25 | 25 | */ |
| 26 | - protected $password = null; |
|
| 26 | + protected $password = NULL; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * RSA public key. |
| 30 | 30 | * |
| 31 | 31 | * @var string |
| 32 | 32 | */ |
| 33 | - protected $publickey = null; |
|
| 33 | + protected $publickey = NULL; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * RSA private key. |
| 37 | 37 | * |
| 38 | 38 | * @var string |
| 39 | 39 | */ |
| 40 | - protected $privatekey = null; |
|
| 40 | + protected $privatekey = NULL; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Passphrase. |
| 44 | 44 | * |
| 45 | 45 | * @var string |
| 46 | 46 | */ |
| 47 | - protected $passphrase = null; |
|
| 47 | + protected $passphrase = NULL; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Hostname. |
| 51 | 51 | * |
| 52 | 52 | * @var string |
| 53 | 53 | */ |
| 54 | - protected $host = null; |
|
| 54 | + protected $host = NULL; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Port. |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function __construct(Configuration $configuration, Authentication $authentication) |
| 31 | 31 | { |
| 32 | - if (extension_loaded('ssh2') == false) |
|
| 32 | + if (extension_loaded('ssh2') == FALSE) |
|
| 33 | 33 | { |
| 34 | 34 | throw new \RuntimeException('The libssh2 extension is not loaded.'); |
| 35 | 35 | } |