Completed
Pull Request — master (#15)
by James
02:25
created

CheckedOutRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
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