Code Duplication    Length = 11-11 lines in 2 locations

src/Backup/Sync/Ftp.php 1 location

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

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