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

GetCommitHash::revision()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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