StandardFileSystem   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createTempFile() 0 7 1
A createTempName() 0 4 1
A removeFile() 0 4 1
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