GitParseRevision   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromStringForRepository() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\BackwardCompatibility\Git;
6
7
use Symfony\Component\Process\Exception\RuntimeException;
8
use Symfony\Component\Process\Process;
9
10
final class GitParseRevision implements ParseRevision
11
{
12
    /**
13
     * {@inheritDoc}
14
     *
15
     * @throws RuntimeException
16
     */
17
    public function fromStringForRepository(string $something, CheckedOutRepository $repository) : Revision
18
    {
19
        return Revision::fromSha1(
20
            (new Process(['git', 'rev-parse', $something]))
21
                ->setWorkingDirectory($repository->__toString())
22
                ->mustRun()
23
                ->getOutput()
24
        );
25
    }
26
}
27