@@ -11,21 +11,21 @@ discard block |
||
11 | 11 | class Builder |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
14 | + /** |
|
15 | 15 | * Command prefix. |
16 | 16 | * |
17 | 17 | * @var string |
18 | 18 | */ |
19 | - public $prefix; |
|
19 | + public $prefix; |
|
20 | 20 | |
21 | - /** |
|
21 | + /** |
|
22 | 22 | * Command options. |
23 | 23 | * |
24 | 24 | * @var string |
25 | 25 | */ |
26 | 26 | public $options; |
27 | 27 | |
28 | - /** |
|
28 | + /** |
|
29 | 29 | * Command arguments. |
30 | 30 | * |
31 | 31 | * @var string |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | { |
68 | 68 | $options = []; |
69 | 69 | foreach ($opts as $key => $value) |
70 | - { |
|
71 | - if (preg_match('/^-.*$/', $key, $matches)) |
|
72 | - { |
|
73 | - $options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
|
74 | - } |
|
75 | - if (preg_match('/^-.*$/', $value, $matches)) |
|
76 | - { |
|
77 | - $options[] = $value; |
|
78 | - } |
|
79 | - } |
|
70 | + { |
|
71 | + if (preg_match('/^-.*$/', $key, $matches)) |
|
72 | + { |
|
73 | + $options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
|
74 | + } |
|
75 | + if (preg_match('/^-.*$/', $value, $matches)) |
|
76 | + { |
|
77 | + $options[] = $value; |
|
78 | + } |
|
79 | + } |
|
80 | 80 | $this->options = implode(' ', array_filter($options, 'strlen')); |
81 | 81 | return $this; |
82 | 82 | } |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | */ |
90 | 90 | final public function setArguments(array $args) |
91 | 91 | { |
92 | - $arguments = []; |
|
92 | + $arguments = []; |
|
93 | 93 | foreach ($args as $key => $value) |
94 | - { |
|
95 | - if (preg_match('/^-.*$/', $key, $matches)) |
|
96 | - { |
|
97 | - $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
|
98 | - } |
|
99 | - else |
|
100 | - { |
|
101 | - $arguments[] = is_array($value) ? implode(' ', $value) : $value; |
|
102 | - } |
|
103 | - } |
|
104 | - $this->arguments = implode(' ', array_filter($arguments, 'strlen')); |
|
94 | + { |
|
95 | + if (preg_match('/^-.*$/', $key, $matches)) |
|
96 | + { |
|
97 | + $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
|
98 | + } |
|
99 | + else |
|
100 | + { |
|
101 | + $arguments[] = is_array($value) ? implode(' ', $value) : $value; |
|
102 | + } |
|
103 | + } |
|
104 | + $this->arguments = implode(' ', array_filter($arguments, 'strlen')); |
|
105 | 105 | return $this; |
106 | 106 | } |
107 | 107 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | if (preg_match('/^-.*$/', $key, $matches)) |
72 | 72 | { |
73 | - $options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
|
73 | + $options[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT).$value; |
|
74 | 74 | } |
75 | 75 | if (preg_match('/^-.*$/', $value, $matches)) |
76 | 76 | { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | if (preg_match('/^-.*$/', $key, $matches)) |
96 | 96 | { |
97 | - $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
|
97 | + $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT).$value; |
|
98 | 98 | } |
99 | 99 | else |
100 | 100 | { |
@@ -95,8 +95,7 @@ |
||
95 | 95 | if (preg_match('/^-.*$/', $key, $matches)) |
96 | 96 | { |
97 | 97 | $arguments[] = is_bool($value) ? $key : str_pad($key, strlen($key) + 1, ' ', STR_PAD_RIGHT) . $value; |
98 | - } |
|
99 | - else |
|
98 | + } else |
|
100 | 99 | { |
101 | 100 | $arguments[] = is_array($value) ? implode(' ', $value) : $value; |
102 | 101 | } |
@@ -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') |
@@ -93,12 +93,12 @@ |
||
93 | 93 | */ |
94 | 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 | - $string_len = strlen($command . PHP_EOL); |
|
98 | + $string_len = strlen($command.PHP_EOL); |
|
99 | 99 | while ($write_count < $string_len) |
100 | 100 | { |
101 | - $fwrite_count = fwrite($this->stream, substr($command . PHP_EOL, $write_count), 1024); |
|
101 | + $fwrite_count = fwrite($this->stream, substr($command.PHP_EOL, $write_count), 1024); |
|
102 | 102 | if ($fwrite_count === FALSE) |
103 | 103 | { |
104 | 104 | throw new \RuntimeException('failed to write command to stream'); |
@@ -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 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | if ($this->is_file($srcfile) === FALSE) |
53 | 53 | { |
54 | - $this->set_error('Local file ' . $srcfile . ' does not exist.'); |
|
54 | + $this->set_error('Local file '.$srcfile.' does not exist.'); |
|
55 | 55 | $this->set_exitstatus(1); |
56 | 56 | return; |
57 | 57 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->set_exitstatus(1); |
63 | 63 | return; |
64 | 64 | } |
65 | - $this->set_output('Successfully copied file at: ' . $srcfile . ' to ' . $destfile); |
|
65 | + $this->set_output('Successfully copied file at: '.$srcfile.' to '.$destfile); |
|
66 | 66 | $this->set_exitstatus(0); |
67 | 67 | } |
68 | 68 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | } |
94 | - $this->set_output('Successfully deleted remote file(s) at: ' . implode(', ', $files)); |
|
94 | + $this->set_output('Successfully deleted remote file(s) at: '.implode(', ', $files)); |
|
95 | 95 | $this->set_exitstatus(0); |
96 | 96 | } |
97 | 97 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | if ($file != '.' && $file != '..') |
134 | 134 | { |
135 | - $filename = rtrim($path, '/') . '/' . $file; |
|
135 | + $filename = rtrim($path, '/').'/'.$file; |
|
136 | 136 | if ($this->is_dir($filename)) |
137 | 137 | { |
138 | 138 | $files['directories'][] = $filename; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $handle = opendir($this->sftp_url($directory)); |
170 | 170 | while (($file = readdir($handle)) !== FALSE) |
171 | 171 | { |
172 | - $files[] = preg_grep('/(^.*' . $pattern . '.*$)/', explode(PHP_EOL, $file)); |
|
172 | + $files[] = preg_grep('/(^.*'.$pattern.'.*$)/', explode(PHP_EOL, $file)); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | if (empty($files)) |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $_files = []; |
186 | 186 | foreach ($files as $file) |
187 | 187 | { |
188 | - $_files[] = rtrim($directory, '/') . '/' . $file; |
|
188 | + $_files[] = rtrim($directory, '/').'/'.$file; |
|
189 | 189 | } |
190 | 190 | $this->set_output($_files); |
191 | 191 | $this->set_exitstatus(0); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | return; |
213 | 213 | } |
214 | 214 | } |
215 | - $this->set_output('Successfully created remote directory(ies) at: ' . implode(', ', $directories)); |
|
215 | + $this->set_output('Successfully created remote directory(ies) at: '.implode(', ', $directories)); |
|
216 | 216 | $this->set_exitstatus(0); |
217 | 217 | } |
218 | 218 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | if ($this->is_file($oldfile) === FALSE) |
229 | 229 | { |
230 | - $this->set_error('Local file ' . $oldfile . ' does not exist.'); |
|
230 | + $this->set_error('Local file '.$oldfile.' does not exist.'); |
|
231 | 231 | $this->set_exitstatus(1); |
232 | 232 | return; |
233 | 233 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $this->set_exitstatus(1); |
239 | 239 | return; |
240 | 240 | } |
241 | - $this->set_output('Successfully renamed remote file at: ' . $oldfile . ' to ' . $newfile); |
|
241 | + $this->set_output('Successfully renamed remote file at: '.$oldfile.' to '.$newfile); |
|
242 | 242 | $this->set_exitstatus(0); |
243 | 243 | } |
244 | 244 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | } |
282 | 282 | } |
283 | 283 | } |
284 | - $this->set_output('Successfully removed remote directory(ies) at: ' . implode(', ', $directories)); |
|
284 | + $this->set_output('Successfully removed remote directory(ies) at: '.implode(', ', $directories)); |
|
285 | 285 | $this->set_exitstatus(0); |
286 | 286 | } |
287 | 287 | |
@@ -298,14 +298,14 @@ discard block |
||
298 | 298 | $local_files = !is_array($local_files) ? [$local_files] : $local_files; |
299 | 299 | foreach ($local_files as $local_file) |
300 | 300 | { |
301 | - if (!@ssh2_scp_send($this->connection, $local_file, rtrim($remote_dir, '/') . '/' . basename($local_file), $mode)) |
|
301 | + if (!@ssh2_scp_send($this->connection, $local_file, rtrim($remote_dir, '/').'/'.basename($local_file), $mode)) |
|
302 | 302 | { |
303 | 303 | $this->set_error($this->get_error_message()); |
304 | 304 | $this->set_exitstatus(1); |
305 | 305 | return; |
306 | 306 | } |
307 | 307 | } |
308 | - $this->set_output('Successfully sent local files to remote host at: ' . implode(', ', $local_files)); |
|
308 | + $this->set_output('Successfully sent local files to remote host at: '.implode(', ', $local_files)); |
|
309 | 309 | $this->set_exitstatus(0); |
310 | 310 | } |
311 | 311 | |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | $remote_files = !is_array($remote_files) ? [$remote_files] : $remote_files; |
322 | 322 | foreach ($remote_files as $remote_file) |
323 | 323 | { |
324 | - if (!@ssh2_scp_recv($this->connection, $remote_file, rtrim($local_dir, '/') . '/' . basename($remote_file))) |
|
324 | + if (!@ssh2_scp_recv($this->connection, $remote_file, rtrim($local_dir, '/').'/'.basename($remote_file))) |
|
325 | 325 | { |
326 | 326 | $this->set_error($this->get_error_message()); |
327 | 327 | $this->set_exitstatus(1); |
328 | 328 | return; |
329 | 329 | } |
330 | 330 | } |
331 | - $this->set_output('Successfully received remote files: ' . implode(', ', $remote_files)); |
|
331 | + $this->set_output('Successfully received remote files: '.implode(', ', $remote_files)); |
|
332 | 332 | $this->set_exitstatus(0); |
333 | 333 | } |
334 | 334 | |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | */ |
370 | 370 | final private function sftp_url($path = '') |
371 | 371 | { |
372 | - return 'ssh2.sftp://' . $this->sftp . $path; |
|
372 | + return 'ssh2.sftp://'.$this->sftp.$path; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | } |
@@ -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); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | break; |
140 | 140 | |
141 | 141 | default: |
142 | - throw new \RuntimeException('Unknown output mode type: ' . $this->get_mode()); |
|
142 | + throw new \RuntimeException('Unknown output mode type: '.$this->get_mode()); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | if (!is_resource($this->connection)) |
156 | 156 | { |
157 | - throw new \RuntimeException(__FUNCTION__ . ': not a valid SSH2 Session resource.'); |
|
157 | + throw new \RuntimeException(__FUNCTION__.': not a valid SSH2 Session resource.'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $command .= '; echo "RETURN_CODE:[$?]"'; |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @var string |
44 | 44 | */ |
45 | - public $mode = NULL; |
|
45 | + public $mode = null; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Filename path. |
49 | 49 | * |
50 | 50 | * @var string |
51 | 51 | */ |
52 | - public $filename = NULL; |
|
52 | + public $filename = null; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Constructor. |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | final public function get_mode() |
94 | 94 | { |
95 | - return ($this->mode === NULL) ? self::WAIT : $this->mode; |
|
95 | + return ($this->mode === null) ? self::WAIT : $this->mode; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param instance $terminal Terminal instance |
113 | 113 | * @return void |
114 | 114 | */ |
115 | - final public function exec($command, Terminal $terminal = NULL) |
|
115 | + final public function exec($command, Terminal $terminal = null) |
|
116 | 116 | { |
117 | 117 | if (!$terminal instanceof Terminal) |
118 | 118 | { |
@@ -167,11 +167,11 @@ discard block |
||
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 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | do |
192 | 192 | { |
193 | 193 | sleep(1); |
194 | - if ($out === FALSE || $err === FALSE) |
|
194 | + if ($out === false || $err === false) |
|
195 | 195 | { |
196 | 196 | $stderr .= 'STDOUT and/or STDERR stream(s) closed unexpectedly.'; |
197 | 197 | return 1; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | final private function exec_file($stream) |
239 | 239 | { |
240 | - if ($this->get_filename() === NULL) |
|
240 | + if ($this->get_filename() === null) |
|
241 | 241 | { |
242 | 242 | throw new \RuntimeException('A valid filename path must be provided.'); |
243 | 243 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | $this->privkeyfile, |
83 | 83 | $this->passphrase, |
84 | 84 | $this->local_username |
85 | - ) === FALSE) |
|
85 | + ) === false) |
|
86 | 86 | { |
87 | 87 | throw new \RuntimeException('Hostbased file authentication failed.'); |
88 | 88 | } |
@@ -16,42 +16,42 @@ discard block |
||
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. |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @var boolean |
74 | 74 | */ |
75 | - protected $tunnel = FALSE; |
|
75 | + protected $tunnel = false; |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * SSH tunnel hostname. |
79 | 79 | * |
80 | 80 | * @var string |
81 | 81 | */ |
82 | - protected $tunnel_host = NULL; |
|
82 | + protected $tunnel_host = null; |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * SSH tunnel port. |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | * @param array $methods remote connection methods |
179 | 179 | * @return object \LibSSH2\Configuration object |
180 | 180 | */ |
181 | - final public function set_methods(array $methods = NULL) |
|
181 | + final public function set_methods(array $methods = null) |
|
182 | 182 | { |
183 | - if ($methods !== NULL) |
|
183 | + if ($methods !== null) |
|
184 | 184 | { |
185 | 185 | $this->methods = $methods; |
186 | 186 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | final public function set_tunnel() |
196 | 196 | { |
197 | - $this->tunnel = TRUE; |
|
197 | + $this->tunnel = true; |
|
198 | 198 | return $this; |
199 | 199 | } |
200 | 200 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | final public function get_username() |
232 | 232 | { |
233 | - if ($this->username === NULL) |
|
233 | + if ($this->username === null) |
|
234 | 234 | { |
235 | 235 | throw new \RuntimeException('A username is required to authenticate to the remote server.'); |
236 | 236 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | final public function get_password() |
246 | 246 | { |
247 | - if ($this->password === NULL) |
|
247 | + if ($this->password === null) |
|
248 | 248 | { |
249 | 249 | throw new \RuntimeException('Password is not currently set.'); |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | final public function get_publickey() |
260 | 260 | { |
261 | - if ($this->publickey === NULL) |
|
261 | + if ($this->publickey === null) |
|
262 | 262 | { |
263 | 263 | throw new \RuntimeException('No RSA public key found.'); |
264 | 264 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | final public function get_privatekey() |
274 | 274 | { |
275 | - if ($this->privatekey === NULL) |
|
275 | + if ($this->privatekey === null) |
|
276 | 276 | { |
277 | 277 | throw new \RuntimeException('No RSA private key found.'); |
278 | 278 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | final public function get_passphrase() |
288 | 288 | { |
289 | - return ($this->passphrase === NULL) ? '' : $this->passphrase; |
|
289 | + return ($this->passphrase === null) ? '' : $this->passphrase; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | final public function get_host() |
298 | 298 | { |
299 | - if ($this->host === NULL) |
|
299 | + if ($this->host === null) |
|
300 | 300 | { |
301 | 301 | throw new \RuntimeException('Unable to create remote connection; no hostname was set.'); |
302 | 302 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | final public function get_methods() |
322 | 322 | { |
323 | - if ($this->methods !== NULL || !empty($this->methods)) |
|
323 | + if ($this->methods !== null || !empty($this->methods)) |
|
324 | 324 | { |
325 | 325 | return $this->methods; |
326 | 326 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | final public function get_tunnel_host() |
345 | 345 | { |
346 | - if ($this->tunnel_host === NULL) |
|
346 | + if ($this->tunnel_host === null) |
|
347 | 347 | { |
348 | 348 | throw new \RuntimeException('A valid hostname must be set prior to attempting a tunnel connection.'); |
349 | 349 | } |
@@ -29,7 +29,7 @@ discard block |
||
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 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | final public function connect(Configuration $configuration) |
63 | 63 | { |
64 | 64 | $this->connection = @ssh2_connect($configuration->get_host(), $configuration->get_port(), $configuration->get_methods()); |
65 | - if ($this->connection === FALSE || !is_resource($this->connection)) |
|
65 | + if ($this->connection === false || !is_resource($this->connection)) |
|
66 | 66 | { |
67 | 67 | throw new \RuntimeException($this->get_error_message()); |
68 | 68 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | final public function tunnel(Configuration $configuration) |
79 | 79 | { |
80 | 80 | $tunnel = @ssh2_tunnel($this->connection, $configuration->get_tunnel_host(), $configuration->get_tunnel_port()); |
81 | - if ($tunnel === FALSE) |
|
81 | + if ($tunnel === false) |
|
82 | 82 | { |
83 | 83 | throw new \RuntimeException($this->get_error_message()); |
84 | 84 | } |