GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 608362...8df995 )
by Sebastian
01:53
created

Snapshot::path()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Spatie\Snapshots;
4
5
class Snapshot
6
{
7
    /** @var string */
8
    private $id;
9
10
    /** @var \Spatie\Snapshots\Filesystem */
11
    private $filesystem;
12
13
    /** @var \Spatie\Snapshots\Driver */
14
    private $driver;
15
16
    public function __construct(
17
        string $id,
18
        Filesystem $filesystem,
19
        Driver $driver
20
    ) {
21
        $this->id = $id;
22
        $this->filesystem = $filesystem;
23
        $this->driver = $driver;
24
    }
25
26
    public static function forTestCase(
27
        string $id,
28
        string $directory,
29
        Driver $driver
30
    ): self {
31
        $filesystem = Filesystem::inDirectory($directory);
32
33
        return new self($id, $filesystem, $driver);
34
    }
35
36
    public function id(): string
37
    {
38
        return $this->id;
39
    }
40
41
    public function filename(): string
42
    {
43
        return $this->id.$this->driver->extension();
44
    }
45
46
    public function exists(): bool
47
    {
48
        return $this->filesystem->has($this->filename());
49
    }
50
51
    public function assertMatches($actual)
52
    {
53
        $this->driver->match($this->filesystem->read($this->filename()), $actual);
54
    }
55
56
    public function create($actual)
57
    {
58
        $this->filesystem->put($this->filename(), $this->driver->serialize($actual));
59
    }
60
}
61