Net_SSH2::getLastError PHP Method

getLastError() public method

Returns the last error
public getLastError ( ) : string
return string
    function getLastError()
    {
        $count = count($this->errors);
        if ($count > 0) {
            return $this->errors[$count - 1];
        }
    }

Usage Example

Example #1
0
 /**
  * @param $command
  *
  * @throws \RuntimeException
  * @throws \Jumper\Exception\CommunicatorException
  * @return String
  */
 public function run($command)
 {
     $result = $this->ssh->exec($command);
     if ($result === false) {
         throw new CommunicatorException($this->ssh->getLastError());
     }
     $error = $this->ssh->getStdError();
     if (!empty($error)) {
         throw new \RuntimeException($error);
     }
     return $result;
 }
All Usage Examples Of Net_SSH2::getLastError