Completed
Push — master ( d83206...aa4419 )
by Marco
10s
created

GitParseRevision::fromStringForRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
nc 1
nop 2
dl 0
loc 7
c 0
b 0
f 0
cc 1
rs 9.4285
1
<?php
2
declare(strict_types=1);
3
4
namespace Roave\ApiCompare\Git;
5
6
use Symfony\Component\Process\Process;
7
8
final class GitParseRevision implements ParseRevision
9
{
10
    /**
11
     * {@inheritDoc}
12
     * @throws \Symfony\Component\Process\Exception\RuntimeException
13
     */
14
    public function fromStringForRepository(string $something, CheckedOutRepository $repository) : Revision
15
    {
16
        return Revision::fromSha1(
17
            (new Process(['git', 'rev-parse', $something]))
18
                ->setWorkingDirectory((string)$repository)
19
                ->mustRun()
20
                ->getOutput()
21
        );
22
    }
23
}
24