Code Duplication    Length = 11-13 lines in 3 locations

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

@@ 250-262 (lines=13) @@
247
     * @throws \RuntimeException
248
     * @return mixed
249
     */
250
    public function remove($path, $recursive = true)
251
    {
252
        $recursiveFlag = ($recursive ? 'r' : '');
253
254
        $remoteCommand = sprintf("rm -{$recursiveFlag}f %s", $path);
255
        $commandline   = sprintf("ssh %s@%s \"%s\"", $this->getUser(), $this->getHost(), $remoteCommand);
256
257
        $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_REMOVE, new TransporterEvent($this, array('path' => $path)));
258
259
        if ($this->cli->execute($commandline)) {
260
            throw new \RuntimeException($this->cli->getErrorOutput());
261
        }
262
    }
263
264
    /**
265
     * @todo this is just a simple implementation which should be improved

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

@@ 174-184 (lines=11) @@
171
     * @throws \RuntimeException
172
     * @return mixed
173
     */
174
    public function symlink($src, $dest)
175
    {
176
        $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_SYMLINK, new TransporterEvent($this, array('dest' => $dest, 'src' => $src)));
177
178
        $remoteCommand = sprintf("ln -s %s %s", $src, $dest);
179
        $commandline   = sprintf("ssh %s@%s \"%s\"", $this->getUser(), $this->getHost(), $remoteCommand);
180
181
        if ($this->cli->execute($commandline)) {
182
            throw new \RuntimeException($this->cli->getErrorOutput());
183
        }
184
    }
185
186
    /**
187
     * Checks for symlink on the remote server
@@ 235-247 (lines=13) @@
232
     * @throws \RuntimeException
233
     * @return mixed
234
     */
235
    public function remove($path, $recursive = true)
236
    {
237
        $recursiveFlag = ($recursive ? 'r' : '');
238
239
        $remoteCommand = sprintf("rm -{$recursiveFlag}f %s", $path);
240
        $commandline   = sprintf("ssh %s@%s \"%s\"", $this->getUser(), $this->getHost(), $remoteCommand);
241
242
        $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_REMOVE, new TransporterEvent($this, array('path' => $path)));
243
244
        if ($this->cli->execute($commandline)) {
245
            throw new \RuntimeException($this->cli->getErrorOutput());
246
        }
247
    }
248
249
    /**
250
     * @todo this is just a simple implementation which should be improved