StubGitWrapper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 24
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCurrentSha() 0 3 1
A __construct() 0 4 1
A getGitDiff() 0 3 1
A isClean() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DaveLiddament\StaticAnalysisResultsBaseliner\Tests\Unit\Plugins\GitDiffHistoryAnalyser\internal;
6
7
use DaveLiddament\StaticAnalysisResultsBaseliner\Domain\Common\ProjectRoot;
8
use DaveLiddament\StaticAnalysisResultsBaseliner\Plugins\GitDiffHistoryAnalyser\GitCommit;
9
use DaveLiddament\StaticAnalysisResultsBaseliner\Plugins\GitDiffHistoryAnalyser\internal\GitWrapper;
10
11
final class StubGitWrapper implements GitWrapper
12
{
13
    public const GIT_SHA_1 = '683031e66625ba768350e5cb90d01121eae2ba00';
14
    public const GIT_SHA_2 = '0dcb42273e9deffb76997926d6748aa04487a75c';
15
16
    public function __construct(
17
        private string $sha,
18
        private string $diff,
19
    ) {
20
    }
21
22
    public function getCurrentSha(ProjectRoot $projectRoot): GitCommit
23
    {
24
        return new GitCommit($this->sha);
25
    }
26
27
    public function getGitDiff(ProjectRoot $projectRoot, GitCommit $originalCommit): string
28
    {
29
        return $this->diff;
30
    }
31
32
    public function isClean(ProjectRoot $projectRoot): bool
33
    {
34
        return true;
35
    }
36
}
37