Code Duplication    Length = 25-25 lines in 2 locations

lib/midcom/services/rcs/backend/rcs.php 2 locations

@@ 177-201 (lines=25) @@
174
     * @param string version
175
     * @return string versionid before this one or empty string.
176
     */
177
    public function get_prev_version($version)
178
    {
179
        $versions = $this->list_history_numeric();
180
181
        if (   !in_array($version, $versions)
182
            || $version === end($versions))
183
        {
184
            return '';
185
        }
186
187
        $mode = end($versions);
188
189
        while( $mode
190
            && $mode !== $version)
191
        {
192
            $mode = prev($versions);
193
194
            if ($mode === $version)
195
            {
196
                return next($versions);
197
            }
198
        }
199
200
        return '';
201
    }
202
203
    /**
204
     * Mirror method for get_prev_version()
@@ 220-244 (lines=25) @@
217
     * @param string version
218
     * @return string versionid before this one or empty string.
219
     */
220
    public function get_next_version($version)
221
    {
222
        $versions = $this->list_history_numeric();
223
224
        if (   !in_array($version, $versions)
225
            || $version === current($versions))
226
        {
227
            return '';
228
        }
229
230
        $mode = current($versions);
231
232
        while (   $mode
233
               && $mode !== $version)
234
        {
235
            $mode = next($versions);
236
237
            if ($mode === $version)
238
            {
239
                return prev($versions);
240
            }
241
        }
242
243
        return '';
244
    }
245
246
    /**
247
     * Return a list of the revisions as a key => value pair where