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

GitParseRevision   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
c 0
b 0
f 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromStringForRepository() 0 7 1
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