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