Completed
Pull Request — master (#15)
by Marco
02:37
created

CheckedOutRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A fromPath() 0 7 1
A __toString() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Roave\ApiCompare\Git;
5
6
use Assert\Assert;
7
8
final class CheckedOutRepository
9
{
10
    /** @var string */
11
    private $path;
12
13
    private function __construct()
14
    {
15
    }
16
17
    public static function fromPath(string $path) : self
18
    {
19
        Assert::that($path)->directory();
20
        Assert::that($path . '/.git')->directory();
21
        $instance = new self();
22
        $instance->path = $path;
23
        return $instance;
24
    }
25
26
    public function __toString() : string
27
    {
28
        return $this->path;
29
    }
30
}
31