| Conditions | 4 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 1 | public function write(string $content, string $fileName): void |
|
| 21 | { |
||
| 22 | 1 | $fullName = rtrim($this->baseDir, '/') . '/' . $fileName; |
|
| 23 | |||
| 24 | 1 | $dir = dirname($fullName); |
|
| 25 | |||
| 26 | 1 | if (!file_exists($dir)) { |
|
| 27 | 1 | mkdir($dir, 0755, true); |
|
| 28 | } |
||
| 29 | 1 | if (!file_exists($fullName) || basename($fullName) === self::CONFIG_FILE_NAME) { |
|
| 30 | 1 | file_put_contents($fullName, $content); |
|
| 31 | } |
||
| 34 |