public function login(string $user, string $password, $attempts = 1, $sleepBetweenAttempts = 5)
    {
        if (!@ftp_login($this->ftp, $user, $password)) {
            if (--$attempts > 0) {
                sleep($sleepBetweenAttempts);

                return $this->login($user, $password, $attempts, $sleepBetweenAttempts);
            }

            throw new Exception(sprintf("Cannot login to host %s", $this->host));
        }

        return $this;
    }
public function login(string $user, string $password, $attempts = 1, $sleepBetweenAttempts = 5)
    {
        if (!@ftp_login($this->ftp, $user, $password)) {
            if (--$attempts > 0) {
                sleep($sleepBetweenAttempts);

                return $this->login($user, $password, $attempts, $sleepBetweenAttempts);
            }

            throw new Exception(sprintf("Cannot login to host %s", $this->host));
        }

        return $this;
    }
public function login ( string $ user , string $ password , $ attempts = 1 , $ sleepBetweenAttempts = 5 ) { if ( ! @ ftp_login ( $ this -> ftp , $ user , $ password ) ) { if ( -- $ attempts > 0 ) { sleep ( $ sleepBetweenAttempts ) ; return $ this -> login ( $ user , $ password , $ attempts , $ sleepBetweenAttempts ) ; } throw new Exception ( sprintf ( "Cannot login to host %s" , $ this -> host ) ) ; } return $ this ; }
Login to server.

@param string $user
@param string $password
@param int    $attempts             [optional] Number of retries in case of error.
@param int    $sleepBetweenAttempts [optional] Sleep time in seconds between attempts.

@return $this
@throws Exception
Login to server .