Code Duplication    Length = 11-11 lines in 2 locations

src/Backup/Sync/Sftp.php 1 location

@@ 110-120 (lines=11) @@
107
        // silence phpseclib
108
        $old  = error_reporting(0);
109
        $sftp = new phpseclib\Net\SFTP($this->host);
110
        if (!$sftp->login($this->user, $this->password)) {
111
            error_reporting($old);
112
            throw new Exception(
113
                sprintf(
114
                    'authentication failed for %s@%s%s',
115
                    $this->user,
116
                    $this->host,
117
                    empty($this->password) ? '' : ' with password ****'
118
                )
119
            );
120
        }
121
        // restore old error reporting
122
        error_reporting($old);
123

src/Backup/Sync/Ftp.php 1 location

@@ 101-111 (lines=11) @@
98
            );
99
        }
100
101
        if (!ftp_login($this->ftpConnection, $this->user, $this->password)) {
102
            error_reporting($old);
103
            throw new Exception(
104
                sprintf(
105
                    'authentication failed for %s@%s%s',
106
                    $this->user,
107
                    $this->host,
108
                    empty($this->password) ? '' : ' with password ****'
109
                )
110
            );
111
        }
112
113
        // Set passive mode if needed
114
        ftp_pasv($this->ftpConnection, $this->passive);