GitRepository::getMergeBase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
4
namespace TheCodingMachine\WashingMachine\Git;
5
6
7
class GitRepository extends \Cz\Git\GitRepository
8
{
9
    public function getMergeBase(string $commit1, string $commit2) : string
10
    {
11
        $results = $this->extractFromCommand('git merge-base ' . escapeshellarg($commit1). ' '. escapeshellarg($commit2));
12
13
        return $results[0];
14
    }
15
16
    public function getLatestCommitForBranch(string $branch) : string
17
    {
18
        $results = $this->extractFromCommand('git log -n 1 --pretty=format:"%H" ' . escapeshellarg($branch));
19
20
        return $results[0];
21
    }
22
}