GitRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMergeBase() 0 6 1
A getLatestCommitForBranch() 0 6 1
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
}