Completed
Pull Request — 1.x (#352)
by Akihito
01:26
created

FilePutContents   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Package\Compiler;
6
7
use function file_exists;
8
use function file_put_contents;
9
10
class FilePutContents
11
{
12
    /** @var list<string> */
13
    private $overwritten = [];
14
15
    public function __invoke(string $fileName, string $content): void
16
    {
17
        if (file_exists($fileName)) {
18
            $this->overwritten[] = $fileName;
19
        }
20
21
        file_put_contents($fileName, $content);
22
    }
23
}
24