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

@@ 87-97 (lines=11) @@
84
            );
85
        }
86
87
        if (!ftp_login($ftpConnection, $this->user, $this->password)) {
88
            error_reporting($old);
89
            throw new Exception(
90
                sprintf(
91
                    'authentication failed for %s@%s%s',
92
                    $this->user,
93
                    $this->host,
94
                    empty($this->password) ? '' : ' with password ****'
95
                )
96
            );
97
        }
98
99
        // Set passive mode if needed
100
        ftp_pasv($ftpConnection, $this->passiveMode);