Code Duplication    Length = 23-23 lines in 2 locations

src/Webcreate/Conveyor/Transporter/FtpTransporter.php 1 location

@@ 96-118 (lines=23) @@
93
        ftp_mkdir($this->stream, $dest);
94
    }
95
96
    public function get($src, $dest = null)
97
    {
98
        if (!$this->stream) {
99
            $this->connectAndLogin();
100
        }
101
102
        $realDest = $dest;
103
104
        if (null == $dest) {
105
            $realDest = tempnam(sys_get_temp_dir(), basename($src));
106
        }
107
108
        $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_GET, new TransporterEvent($this, array('src' => $src, 'dest' => $dest)));
109
110
        $succes = ftp_get($this->stream, $realDest, $src, FTP_BINARY);
111
112
        if (null == $dest) {
113
            $content = file_get_contents($realDest);
114
            unlink($realDest);
115
116
            return $content;
117
        }
118
    }
119
120
    public function put($src, $dest)
121
    {

src/Webcreate/Conveyor/Transporter/SftpTransporter.php 1 location

@@ 198-220 (lines=23) @@
195
        }
196
    }
197
198
    public function get($src, $dest = null)
199
    {
200
        if (false === $this->isConnected()) {
201
            $this->connectAndLogin();
202
        }
203
204
        $realDest = $dest;
205
206
        if (null == $dest) {
207
            $realDest = tempnam(sys_get_temp_dir(), basename($src));
208
        }
209
210
        $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_GET, new TransporterEvent($this, array('src' => $src, 'dest' => $dest)));
211
212
        $succes = $this->sftp->get($src, $realDest);
213
214
        if (null == $dest) {
215
            $content = file_get_contents($realDest);
216
            unlink($realDest);
217
218
            return $content;
219
        }
220
    }
221
222
    public function put($src, $dest)
223
    {