Code Duplication    Length = 11-11 lines in 3 locations

src/GitWrapper/GitWorkingCopy.php 3 locations

@@ 238-248 (lines=11) @@
235
     * @throws \GitWrapper\GitException
236
     *   Thrown when HEAD does not have a remote tracking branch.
237
     */
238
    public function isAhead()
239
    {
240
        if (!$this->isTracking()) {
241
            throw new GitException('Error: HEAD does not have a remote tracking branch. Cannot check if it is ahead.');
242
        }
243
        $this->clearOutput();
244
        $merge_base = (string) $this->run(array('merge-base @ @{u}'));
245
        $local_sha = (string) $this->run(array('rev-parse @'));
246
        $remote_sha = (string) $this->run(array('rev-parse @{u}'));
247
        return $merge_base === $remote_sha && $local_sha !== $remote_sha;
248
    }
249
250
    /**
251
     * Returns whether HEAD is behind its remote tracking branch.
@@ 261-271 (lines=11) @@
258
     * @throws \GitWrapper\GitException
259
     *   Thrown when HEAD does not have a remote tracking branch.
260
     */
261
    public function isBehind()
262
    {
263
        if (!$this->isTracking()) {
264
            throw new GitException('Error: HEAD does not have a remote tracking branch. Cannot check if it is behind.');
265
        }
266
        $this->clearOutput();
267
        $merge_base = (string) $this->run(array('merge-base @ @{u}'));
268
        $local_sha = (string) $this->run(array('rev-parse @'));
269
        $remote_sha = (string) $this->run(array('rev-parse @{u}'));
270
        return $merge_base === $local_sha && $local_sha !== $remote_sha;
271
    }
272
273
    /**
274
     * Returns whether HEAD needs to be merged with its remote tracking branch.
@@ 286-296 (lines=11) @@
283
     * @throws \GitWrapper\GitException
284
     *   Thrown when HEAD does not have a remote tracking branch.
285
     */
286
    public function needsMerge()
287
    {
288
        if (!$this->isTracking()) {
289
            throw new GitException('Error: HEAD does not have a remote tracking branch. Cannot check if it is behind.');
290
        }
291
        $this->clearOutput();
292
        $merge_base = (string) $this->run(array('merge-base @ @{u}'));
293
        $local_sha = (string) $this->run(array('rev-parse @'));
294
        $remote_sha = (string) $this->run(array('rev-parse @{u}'));
295
        return $merge_base !== $local_sha && $merge_base !== $remote_sha;
296
    }
297
298
    /**
299
     * Returns a GitBranches object containing information on the repository's