| @@ -386,7 +386,7 @@ discard block | ||
| 386 | 386 |  				if (mb_strpos($entry[1], 'Auto') !== FALSE) { | 
| 387 | 387 | $result['speed'] = 'auto'; | 
| 388 | 388 |  				} else { | 
| 389 | - $result['speed'] = (int)$entry[1]; | |
| 389 | + $result['speed'] = (int) $entry[1]; | |
| 390 | 390 | } // if .. else | 
| 391 | 391 | $entry[2] = rtrim($entry[2]); | 
| 392 | 392 | $result['type'] = mb_substr($entry[2], mb_strrpos($entry[2], ' ') + 1); | 
| @@ -563,7 +563,7 @@ discard block | ||
| 563 | 563 |  			foreach ($this->_data as $vlan) { | 
| 564 | 564 |  				$vlan = explode(' ', $vlan); | 
| 565 | 565 | $vlan = mb_substr($vlan[0], 4); | 
| 566 | - $result[] = (int)$vlan; | |
| 566 | + $result[] = (int) $vlan; | |
| 567 | 567 | } // foreach | 
| 568 | 568 | } // if | 
| 569 | 569 | $this->_data = $result; | 
| @@ -748,14 +748,14 @@ discard block | ||
| 748 | 748 |  		$config_prompt = str_replace("\r\n", '', trim($config_prompt)); | 
| 749 | 749 |  		if (mb_strpos($config_prompt, 'config)#') !== FALSE) { | 
| 750 | 750 | foreach ($this->_data as $c) | 
| 751 | - $this->_ssh->write($c . "\n"); | |
| 751 | + $this->_ssh->write($c."\n"); | |
| 752 | 752 |  			$this->_ssh->write("end\n"); | 
| 753 | 753 | } | 
| 754 | 754 | $result = $this->_ssh->read($this->_prompt); | 
| 755 | 755 |  		$result = explode("\r\n", $result); | 
| 756 | 756 | if (count($this->_data) == (count($result) - 2)) | 
| 757 | 757 | return true; else | 
| 758 | -			die('Error: Switch rejected configuration: '.PHP_EOL . $config . "\n"); | |
| 758 | +			die('Error: Switch rejected configuration: '.PHP_EOL.$config."\n"); | |
| 759 | 759 | } | 
| 760 | 760 | |
| 761 | 761 | /** | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | 93 | /** | 
| 94 | - * @param $string | |
| 94 | + * @param string $string | |
| 95 | 95 | * @param int $index | 
| 96 | 96 | * @return string | 
| 97 | 97 | */ | 
| @@ -142,7 +142,7 @@ discard block | ||
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | 144 | /** | 
| 145 | - * @param $cmd | |
| 145 | + * @param string $cmd | |
| 146 | 146 | */ | 
| 147 | 147 |  	public function write($cmd) { | 
| 148 | 148 | fwrite($this->_stream, $cmd); | 
| @@ -211,7 +211,7 @@ discard block | ||
| 211 | 211 | } | 
| 212 | 212 | |
| 213 | 213 | /** | 
| 214 | - * @param $cmd | |
| 214 | + * @param string $cmd | |
| 215 | 215 | * @return string | 
| 216 | 216 | */ | 
| 217 | 217 |  	public function exec($cmd) { | 
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | } | 
| 237 | 237 | |
| 238 | 238 | /** | 
| 239 | - * @return mixed | |
| 239 | + * @return string | |
| 240 | 240 | */ | 
| 241 | 241 |  	public function get_response() { | 
| 242 | 242 | return $this->_response; | 
| @@ -735,7 +735,7 @@ discard block | ||
| 735 | 735 | |
| 736 | 736 | /** | 
| 737 | 737 | * @param $config | 
| 738 | - * @return bool | |
| 738 | + * @return null|boolean | |
| 739 | 739 | */ | 
| 740 | 740 |  	public function configure($config) { | 
| 741 | 741 | // USE AT OWN RISK: This function will apply configuration statements to a device. | 
| @@ -775,7 +775,7 @@ discard block | ||
| 775 | 775 |  class cisco_parser { | 
| 776 | 776 | /** | 
| 777 | 777 | * @param $lines | 
| 778 | - * @param $x | |
| 778 | + * @param integer $x | |
| 779 | 779 | * @return int | 
| 780 | 780 | */ | 
| 781 | 781 |  	public function get_space_depth($lines, $x) { | 
| @@ -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 | |
| @@ -750,7 +750,7 @@ discard block | ||
| 750 | 750 | $result = $this->_ssh->read($this->_prompt); | 
| 751 | 751 |  		$result = explode("\r\n", $result); | 
| 752 | 752 | if (count($this->_data) == (count($result) - 2)) | 
| 753 | - return true; else | |
| 753 | + return TRUE; else | |
| 754 | 754 |  			die('Error: Switch rejected configuration: '.PHP_EOL . $config . "\n"); | 
| 755 | 755 | } | 
| 756 | 756 | |
| @@ -760,8 +760,8 @@ discard block | ||
| 760 | 760 |  	public function write_config() { | 
| 761 | 761 |  		$this->exec('write'); | 
| 762 | 762 | if (mb_strpos($this->_data, '[OK]') !== FALSE) | 
| 763 | - return true; else | |
| 764 | - return false; | |
| 763 | + return TRUE; else | |
| 764 | + return FALSE; | |
| 765 | 765 | } | 
| 766 | 766 | } | 
| 767 | 767 | |