@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | if (mb_strpos($entry[1], 'Auto') !== FALSE) { |
| 383 | 383 | $result['speed'] = 'auto'; |
| 384 | 384 | } else { |
| 385 | - $result['speed'] = (int)$entry[1]; |
|
| 385 | + $result['speed'] = (int) $entry[1]; |
|
| 386 | 386 | } // if .. else |
| 387 | 387 | $entry[2] = rtrim($entry[2]); |
| 388 | 388 | $result['type'] = mb_substr($entry[2], mb_strrpos($entry[2], ' ') + 1); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | foreach ($this->_data as $vlan) { |
| 560 | 560 | $vlan = explode(' ', $vlan); |
| 561 | 561 | $vlan = mb_substr($vlan[0], 4); |
| 562 | - $result[] = (int)$vlan; |
|
| 562 | + $result[] = (int) $vlan; |
|
| 563 | 563 | } // foreach |
| 564 | 564 | } // if |
| 565 | 565 | $this->_data = $result; |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $config_prompt = str_replace("\r\n", '', trim($config_prompt)); |
| 745 | 745 | if (mb_strpos($config_prompt, 'config)#') !== FALSE) { |
| 746 | 746 | foreach ($this->_data as $c) |
| 747 | - $this->_ssh->write($c . "\n"); |
|
| 747 | + $this->_ssh->write($c."\n"); |
|
| 748 | 748 | $this->_ssh->write("end\n"); |
| 749 | 749 | } |
| 750 | 750 | $result = $this->_ssh->read($this->_prompt); |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | if (count($this->_data) == (count($result) - 2)) |
| 753 | 753 | return TRUE; |
| 754 | 754 | else |
| 755 | - die('Error: Switch rejected configuration: '.PHP_EOL . $config . "\n"); |
|
| 755 | + die('Error: Switch rejected configuration: '.PHP_EOL.$config."\n"); |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | /** |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * @var bool |
| 26 | 26 | */ |
| 27 | - public $autoconnect = true; // Sets whether or not exec() will automatically connect() if needed |
|
| 27 | + public $autoconnect = TRUE; // Sets whether or not exec() will automatically connect() if needed |
|
| 28 | 28 | /** |
| 29 | 29 | * @var int |
| 30 | 30 | */ |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | //echo 'M:'.print_r($matches, TRUE).'<br>'; |
| 122 | 122 | $match = isset($matches[0]) ? $matches[0] : []; |
| 123 | 123 | } |
| 124 | - $pos = !empty($match) ? mb_strpos($this->_response, $match) : false; |
|
| 124 | + $pos = !empty($match) ? mb_strpos($this->_response, $match) : FALSE; |
|
| 125 | 125 | //echo ++$i . "POS:".var_export($pos, TRUE).'<br>'; |
| 126 | 126 | if ($pos !== FALSE) { |
| 127 | 127 | //echo "$match Matching $pattern @ $pos <br>"; |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | //echo "Connecting to " . $this->_hostname . "<br>"; |
| 155 | 155 | $this->_ssh = ssh2_connect($this->_hostname, $this->_port); |
| 156 | 156 | if ($this->_ssh === FALSE) |
| 157 | - return false; |
|
| 157 | + return FALSE; |
|
| 158 | 158 | ssh2_auth_password($this->_ssh, $this->_username, $this->_password); |
| 159 | 159 | $this->_stream = ssh2_shell($this->_ssh); |
| 160 | - $this->connected = true; |
|
| 160 | + $this->connected = TRUE; |
|
| 161 | 161 | $this->parse_motd_and_prompt(); |
| 162 | - return true; |
|
| 162 | + return TRUE; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $this->_motd = mb_substr($this->_motd, 0, -$length); |
| 175 | 175 | //echo "MOTD:".$this->_motd."<br>"; |
| 176 | 176 | //echo "Prompt:".$this->_prompt.'<br>'; |
| 177 | - return true; |
|
| 177 | + return TRUE; |
|
| 178 | 178 | sleep(1); |
| 179 | 179 | $this->_motd = ''; |
| 180 | 180 | while ($this->_response = fgets($this->_stream)) |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return string |
| 212 | 212 | */ |
| 213 | 213 | public function exec($cmd) { |
| 214 | - if ($this->autoconnect === true && $this->connected === FALSE) |
|
| 214 | + if ($this->autoconnect === TRUE && $this->connected === FALSE) |
|
| 215 | 215 | $this->connect(); |
| 216 | 216 | if (mb_substr($cmd, -1) != "\n") { |
| 217 | 217 | //error_log("Adding NEWLINE Character To SSH2 Command $cmd", __LINE__, __FILE__); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * |
| 251 | 251 | */ |
| 252 | 252 | public function __destruct() { |
| 253 | - if ($this->connected === true) |
|
| 253 | + if ($this->connected === TRUE) |
|
| 254 | 254 | $this->disconnect(); |
| 255 | 255 | } |
| 256 | 256 | |