Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 117-137 (lines=21) @@
114
     * @throws \RuntimeException
115
     * @throws \InvalidArgumentException
116
     */
117
    public function put($src, $dest)
118
    {
119
        if (false === file_exists($src)) {
120
            throw new \InvalidArgumentException(sprintf('Resource \'%s\' does not exist', $src));
121
        }
122
123
        $pwd = dirname($dest);
124
        if (false === $this->exists($pwd)) {
125
            $this->mkdir($pwd);
126
        }
127
128
        $commandline = sprintf("rsync -az \"%s\" '%s@%s:%s'", $src, $this->getUser(), $this->getHost(), $dest);
129
130
        $this->_exists[$dest] = true;
131
132
        $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_PUT, new TransporterEvent($this, array('dest' => $dest, 'src' => $src)));
133
134
        if ($this->cli->execute($commandline)) {
135
            throw new \RuntimeException($this->cli->getErrorOutput());
136
        }
137
    }
138
139
    /**
140
     * Upload a string to remote server

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

@@ 116-136 (lines=21) @@
113
     * @throws \RuntimeException
114
     * @throws \InvalidArgumentException
115
     */
116
    public function put($src, $dest)
117
    {
118
        if (false === file_exists($src)) {
119
            throw new \InvalidArgumentException(sprintf('Resource \'%s\' does not exist', $src));
120
        }
121
122
        $pwd = dirname($dest);
123
        if (false === $this->exists($pwd)) {
124
            $this->mkdir($pwd);
125
        }
126
127
        $commandline = sprintf("scp \"%s\" '%s@%s:%s'", $src, $this->getUser(), $this->getHost(), $dest);
128
129
        $this->_exists[$dest] = true;
130
131
        $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_PUT, new TransporterEvent($this, array('dest' => $dest, 'src' => $src)));
132
133
        if ($this->cli->execute($commandline)) {
134
            throw new \RuntimeException($this->cli->getErrorOutput());
135
        }
136
    }
137
138
    /**
139
     * Upload a string to remote server