Code Duplication    Length = 12-15 lines in 7 locations

src/Backup/Sync/Rsync.php 1 location

@@ 120-134 (lines=15) @@
117
     * @param  \phpbu\App\Result        $result
118
     * @throws \phpbu\App\Backup\Sync\Exception
119
     */
120
    public function sync(Target $target, Result $result)
121
    {
122
        if ($this->args) {
123
            // pro mode define all arguments yourself
124
            // WARNING! no escaping is done by phpbu
125
            $result->debug('WARNING: phpbu uses your rsync args without escaping');
126
        }
127
        $rsync = $this->execute($target);
128
129
        $result->debug($rsync->getCmd());
130
131
        if (!$rsync->wasSuccessful()) {
132
            throw new Exception('rsync failed: ' . $rsync->getStdErr());
133
        }
134
    }
135
136
137
    /**

src/Backup/Source/Arangodump.php 1 location

@@ 137-148 (lines=12) @@
134
     * @return \phpbu\App\Backup\Source\Status
135
     * @throws \phpbu\App\Exception
136
     */
137
    public function backup(Target $target, Result $result)
138
    {
139
        $arangodump = $this->execute($target);
140
141
        $result->debug($arangodump->getCmd());
142
143
        if (!$arangodump->wasSuccessful()) {
144
            throw new Exception('arangodump failed: ' . $arangodump->getStdErr());
145
        }
146
147
        return $this->createStatus($target);
148
    }
149
150
    /**
151
     * Create the Executable to run the arangodump command.

src/Backup/Source/Elasticdump.php 1 location

@@ 107-118 (lines=12) @@
104
     * @return \phpbu\App\Backup\Source\Status
105
     * @throws \phpbu\App\Exception
106
     */
107
    public function backup(Target $target, Result $result)
108
    {
109
        $elasticdump = $this->execute($target);
110
111
        $result->debug($elasticdump->getCmd());
112
113
        if (!$elasticdump->wasSuccessful()) {
114
            throw new Exception('elasticdump failed: ' . $elasticdump->getStdErr());
115
        }
116
117
        return $this->createStatus($target);
118
    }
119
120
    /**
121
     * Create the Executable to run the elasticdump command.

src/Backup/Source/Mongodump.php 1 location

@@ 155-167 (lines=13) @@
152
     * @return \phpbu\App\Backup\Source\Status
153
     * @throws \phpbu\App\Exception
154
     */
155
    public function backup(Target $target, Result $result)
156
    {
157
        // setup dump location and execute the dump
158
        $mongodump = $this->execute($target);
159
160
        $result->debug($mongodump->getCmd());
161
162
        if (!$mongodump->wasSuccessful()) {
163
            throw new Exception('Mongodump failed');
164
        }
165
166
        return $this->createStatus($target);
167
    }
168
169
    /**
170
     * Create the Executable to run the Mongodump command.

src/Backup/Source/Mysqldump.php 1 location

@@ 184-197 (lines=14) @@
181
     * @return \phpbu\App\Backup\Source\Status
182
     * @throws \phpbu\App\Exception
183
     */
184
    public function backup(Target $target, Result $result)
185
    {
186
        // setup dump location and execute the dump
187
        $this->dumpPathname = $target->getPathnamePlain();
188
        $mysqldump          = $this->execute($target);
189
190
        $result->debug($mysqldump->getCmd());
191
192
        if (!$mysqldump->wasSuccessful()) {
193
            throw new Exception('mysqldump failed:' . $mysqldump->getStdErr());
194
        }
195
196
        return $this->createStatus($target);
197
    }
198
199
    /**
200
     * Create the Executable to run the mysqldump command.

src/Backup/Source/Tar.php 1 location

@@ 93-106 (lines=14) @@
90
     * @return \phpbu\App\Backup\Source\Status
91
     * @throws \phpbu\App\Exception
92
     */
93
    public function backup(Target $target, Result $result)
94
    {
95
        // set uncompressed default MIME type
96
        $target->setMimeType('application/x-tar');
97
        $tar    = $this->execute($target);
98
99
        $result->debug($tar->getCmd());
100
101
        if (!$tar->wasSuccessful()) {
102
            throw new Exception('tar failed: ' . $tar->getStdErr());
103
        }
104
105
        return $this->createStatus($target);
106
    }
107
108
    /**
109
     * Setup the Executable to run the 'tar' command.

src/Backup/Source/XtraBackup.php 1 location

@@ 119-130 (lines=12) @@
116
     * @return \phpbu\App\Backup\Source\Status
117
     * @throws \phpbu\App\Exception
118
     */
119
    public function backup(Target $target, Result $result)
120
    {
121
        $innobackupex = $this->execute($target);
122
123
        $result->debug($innobackupex->getCmd());
124
125
        if (!$innobackupex->wasSuccessful()) {
126
            throw new Exception('XtraBackup failed: ' . $innobackupex->getStdErr());
127
        }
128
129
        return $this->createStatus($target);
130
    }
131
132
    /**
133
     * Create the Exec to run the innobackupex backup and apply-log commands.