Lines
100.00%
3 / 3
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| writeSnapshot | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| 9 | final readonly class SnapshotFileWriter | |
| 10 | { | |
| 11 | public function __construct(private SnapshotCodec $codec) {} | |
| 12 | ||
| 13 | /** @throws CodegenException */ | |
| 14 | public function writeSnapshot(string $path, Snapshot $snapshot): void | |
| 15 | { | |
| 16 | if (file_put_contents($path, $this->codec->encodeSnapshot($snapshot)) === false) { | |
| 17 | throw CodegenException::fileNotWritable($path); | |
| 18 | } | |
| 19 | } | |
| 20 | } |