StandardFileSystem::createTempFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace MyBuilder\Cronos\Updater;
4
5
class StandardFileSystem implements FileSystem
6
{
7
    public function createTempFile(string $prefix, string $content): string
8
    {
9
        $filePath = $this->createTempName($prefix);
10
        \file_put_contents($filePath, $content);
11
12
        return $filePath;
13
    }
14
15
    private function createTempName(string $prefix): string
16
    {
17
        return \tempnam(\sys_get_temp_dir(), $prefix);
18
    }
19
20
    public function removeFile(string $filePath): void
21
    {
22
        \unlink($filePath);
23
    }
24
}
25