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 ( 7b3334...7fd26f )
by Sebastian
01:42
created

Filesystem::inDirectory()   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
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Spatie\Snapshots;
4
5
class Filesystem
6
{
7
    /** @var string */
8
    private $basePath;
9
10
    public function __construct(string $basePath)
11
    {
12
        $this->basePath = $basePath;
13
    }
14
15
    public static function inDirectory(string $path): self
16
    {
17
        return new self($path);
18
    }
19
20
    public function path(string $filename): string
21
    {
22
        return $this->basePath.DIRECTORY_SEPARATOR.$filename;
23
    }
24
25
    public function has(string $filename): bool
26
    {
27
        return file_exists($this->path($filename));
28
    }
29
30
    public function read(string $filename): bool
31
    {
32
        return file_get_contents($this->path($filename));
33
    }
34
35
    public function put(string $filename, string $contents)
36
    {
37
        if (! file_exists($this->basePath)) {
38
            mkdir($this->basePath);
39
        }
40
41
        file_put_contents($this->path($filename), $contents);
42
    }
43
}
44