Code Duplication    Length = 13-13 lines in 2 locations

src/Webcreate/Conveyor/Transporter/SftpTransporter.php 2 locations

@@ 239-251 (lines=13) @@
236
237
            $success = $this->sftp->put($dest, $file->getPathname(), PhpseclibSFTP::SOURCE_LOCAL_FILE);
238
239
            if (!$success) {
240
                // maybe the parent directory doesnt exist; try to create it and try again
241
                $pwd = dirname($dest);
242
                if (false === $this->exists($pwd)) {
243
                    $this->mkdir($pwd);
244
245
                    // retry try to put
246
                    $success = $this->sftp->put($dest, $file->getPathname(), PhpseclibSFTP::SOURCE_LOCAL_FILE);
247
                    if (!$success) {
248
                        throw new \RuntimeException('Something went wrong: ' . "\n" . implode("\n", $this->sftp->getSFTPErrors()));
249
                    }
250
                }
251
            }
252
        } else {
253
            if (!$this->exists($dest)) {
254
                $this->mkdir($dest);
@@ 276-288 (lines=13) @@
273
274
        $success = $this->sftp->put($dest, $content, PhpseclibSFTP::SOURCE_STRING);
275
276
        if (!$success) {
277
            // maybe the parent directory doesnt exist; try to create it and try again
278
            $pwd = dirname($dest);
279
            if (false === $this->exists($pwd)) {
280
                $this->mkdir($pwd);
281
282
                // retry try to put
283
                $success = $this->sftp->put($dest, $content, PhpseclibSFTP::SOURCE_STRING);
284
                if (!$success) {
285
                    throw new \RuntimeException('Something went wrong: ' . "\n" . implode("\n", $this->sftp->getSFTPErrors()));
286
                }
287
            }
288
        }
289
    }
290
291
    /**