|
@@ 31-33 (lines=3) @@
|
| 28 |
|
|
| 29 |
|
public function restoreFromFile(string $filePath): Estimator |
| 30 |
|
{ |
| 31 |
|
if (!file_exists($filePath) || !is_readable($filePath)) { |
| 32 |
|
throw FileException::cantOpenFile(basename($filePath)); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
$object = unserialize(file_get_contents($filePath)); |
| 36 |
|
if ($object === false) { |
|
@@ 45-47 (lines=3) @@
|
| 42 |
|
|
| 43 |
|
public function resetFile(string $filePath): void |
| 44 |
|
{ |
| 45 |
|
if (!file_exists($filePath) || !is_readable($filePath)) { |
| 46 |
|
throw FileException::cantOpenFile(basename($filePath)); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
if (!unlink($filePath)) { |
| 50 |
|
throw FileException::cantDeleteFile(basename($filePath)); |