@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | final public function authenticate($resource) |
| 37 | 37 | { |
| 38 | - if (@ssh2_auth_agent($resource, $this->username) === FALSE) |
|
| 38 | + if (@ssh2_auth_agent($resource, $this->username) === false) |
|
| 39 | 39 | { |
| 40 | 40 | throw new \RuntimeException('Agent based authentication failed.'); |
| 41 | 41 | } |
@@ -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 | } |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | final public function get_error_message() |
| 125 | 125 | { |
| 126 | 126 | $this->error_message = error_get_last()['message']; |
| 127 | - return $this->error_message . ' in ' . $this->get_error_file() . ' on line ' . $this->get_error_line(); |
|
| 127 | + return $this->error_message.' in '.$this->get_error_file().' on line '.$this->get_error_line(); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -37,21 +37,21 @@ |
||
| 37 | 37 | * |
| 38 | 38 | * @var string |
| 39 | 39 | */ |
| 40 | - protected $error_message = NULL; |
|
| 40 | + protected $error_message = null; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Last known error line number. |
| 44 | 44 | * |
| 45 | 45 | * @var int |
| 46 | 46 | */ |
| 47 | - protected $error_line_no = NULL; |
|
| 47 | + protected $error_line_no = null; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Last known error filename. |
| 51 | 51 | * |
| 52 | 52 | * @var string |
| 53 | 53 | */ |
| 54 | - protected $error_file = NULL; |
|
| 54 | + protected $error_file = null; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Set STDOUT output stream. |