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 ( 0b4676...ecfcbd )
by joseph
17s queued 14s
created

Writer::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 5
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Filesystem\File;
6
7
class Writer
8
{
9
    /**
10
     * Write a file object to the filesystem and return the created path
11
     *
12
     * @param File $file
13
     *
14
     * @return string
15
     * @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException
16
     */
17
    public function write(File $file): string
18
    {
19
        $this->createDirectoryIfRequired($file);
20
        $file->create();
21
        $file->putContents();
22
23
        return $file->getPath();
24
    }
25
26
    private function createDirectoryIfRequired(File $file): void
27
    {
28
        $directory = $file->getDirectory();
29
        if (false === $directory->exists()) {
30
            $directory->create();
31
        }
32
    }
33
}
34