Completed
Push — master ( 3952c5...023801 )
by Sebastian
02:12
created

GetCommitHash   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 31
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A revision() 0 5 1
A getGitCommand() 0 4 1
1
<?php
2
/**
3
 * This file is part of SebastianFeldmann\Git.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\Git\Command\RevParse;
11
12
use SebastianFeldmann\Git\Command\Base;
13
14
class GetCommitHash extends Base
15
{
16
    /**
17
     * Revision to look up.
18
     *
19
     * @var string
20
     */
21
    private $rev = 'HEAD';
22
23
    /**
24
     * Set revision to look up.
25
     *
26
     * @param  string $revision
27
     * @return \SebastianFeldmann\Git\Command\RevParse\GetCommitHash
28
     */
29 1
    public function revision(string $revision) : GetCommitHash
30
    {
31 1
        $this->rev = $revision;
32 1
        return $this;
33
    }
34
35
    /**
36
     * Return the command to execute.
37
     *
38
     * @return string
39
     */
40 1
    protected function getGitCommand(): string
41
    {
42 1
        return 'rev-parse --verify ' . $this->rev;
43
    }
44
}
45