Code Duplication    Length = 11-11 lines in 2 locations

src/Backup/Sync/Sftp.php 1 location

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

src/Backup/Sync/Ftp.php 1 location

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