|
@@ 48-50 (lines=3) @@
|
| 45 |
|
*/ |
| 46 |
|
public function restoreFromFile(string $filePath): Estimator |
| 47 |
|
{ |
| 48 |
|
if (!file_exists($filePath) || !is_readable($filePath)) { |
| 49 |
|
throw FileException::cantOpenFile(basename($filePath)); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
$object = unserialize(file_get_contents($filePath)); |
| 53 |
|
if ($object === false) { |
|
@@ 69-71 (lines=3) @@
|
| 66 |
|
*/ |
| 67 |
|
public function reset(string $filePath): void |
| 68 |
|
{ |
| 69 |
|
if (!file_exists($filePath) || !is_readable($filePath)) { |
| 70 |
|
throw FileException::cantOpenFile(basename($filePath)); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
if (!unlink($filePath)) { |
| 74 |
|
throw FileException::cantDeleteFile(basename($filePath)); |