| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function restoreFromFile(string $filepath) : Estimator |
||
| 42 | { |
||
| 43 | if (!file_exists($filepath) || !is_readable($filepath)) { |
||
| 44 | throw FileException::cantOpenFile(basename($filepath)); |
||
| 45 | } |
||
| 46 | |||
| 47 | $object = unserialize(file_get_contents($filepath)); |
||
| 48 | if ($object === false) { |
||
| 49 | throw SerializeException::cantUnserialize(basename($filepath)); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $object; |
||
| 53 | } |
||
| 54 | } |
||
| 55 |