protected function connect(ServerInterface $server)
    {
        if (false === function_exists('ssh2_connect')) {
            throw new \RuntimeException('The "ssh2_connect" function does not exist.');
        }

        $con = ssh2_connect($server->getHost(), $server->getPort());

        if (false === $con) {
            throw new SshException(sprintf('Cannot connect to server "%s"', $server->getHost()));
        }

        if (false === ssh2_auth_password($con, $server->getUser(), $server->getPassword())) {
            throw new SshException(sprintf('Authorization failed for user "%s"', $server->getUser()));
        }

        $this->con = $con;
    }
protected function connect(ServerInterface $server)
    {
        if (false === function_exists('ssh2_connect')) {
            throw new \RuntimeException('The "ssh2_connect" function does not exist.');
        }

        $con = ssh2_connect($server->getHost(), $server->getPort());

        if (false === $con) {
            throw new SshException(sprintf('Cannot connect to server "%s"', $server->getHost()));
        }

        if (false === ssh2_auth_password($con, $server->getUser(), $server->getPassword())) {
            throw new SshException(sprintf('Authorization failed for user "%s"', $server->getUser()));
        }

        $this->con = $con;
    }
protected function connect ( ServerInterface $ server ) { if ( false === function_exists ( 'ssh2_connect' ) ) { throw new \ RuntimeException ( 'The "ssh2_connect" function does not exist.' ) ; } $ con = ssh2_connect ( $ server -> getHost ( ) , $ server -> getPort ( ) ) ; if ( false === $ con ) { throw new SshException ( sprintf ( 'Cannot connect to server "%s"' , $ server -> getHost ( ) ) ) ; } if ( false === ssh2_auth_password ( $ con , $ server -> getUser ( ) , $ server -> getPassword ( ) ) ) { throw new SshException ( sprintf ( 'Authorization failed for user "%s"' , $ server -> getUser ( ) ) ) ; } $ this -> con = $ con ; }
Open the SSH connection

@param Plum\Server\ServerInterface $server
Open the SSH connection