Passed
Push — master ( cc6190...196023 )
by Sebastian
36s queued 10s
created

Info   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCurrentCommitHash() 0 6 1
A getCurrentTag() 0 6 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\Operator;
11
12
use SebastianFeldmann\Git\Command\Describe\GetCurrentTag;
13
use SebastianFeldmann\Git\Command\RevParse\GetCommitHash;
14
15
/**
16
 * Class Info
17
 *
18
 * @package SebastianFeldmann\Git
19
 * @author  Sebastian Feldmann <[email protected]>
20
 * @link    https://github.com/sebastianfeldmann/git
21
 * @since   Class available since Release 1.0.8
22
 */
23
class Info extends Base
24
{
25
    /**
26
     * Returns the tag tag of the current commit
27
     *
28
     * @return string
29
     */
30 2
    public function getCurrentTag() : string
31
    {
32 2
        $cmd    = new GetCurrentTag($this->repo->getRoot());
33 2
        $result = $this->runner->run($cmd);
34
35 1
        return trim($result->getStdOut());
36
    }
37
38
    /**
39
     * Returns the the hash of the current commit
40
     *
41
     * @return string
42
     */
43 2
    public function getCurrentCommitHash() : string
44
    {
45 2
        $cmd    = new GetCommitHash($this->repo->getRoot());
46 2
        $result = $this->runner->run($cmd);
47
48 1
        return trim($result->getStdOut());
49
    }
50
}
51