| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public static function restoreFromFile(string $filepath) |
||
| 34 | { |
||
| 35 | if (!file_exists($filepath) || !is_readable($filepath)) { |
||
| 36 | throw FileException::cantOpenFile(basename($filepath)); |
||
| 37 | } |
||
| 38 | |||
| 39 | $object = unserialize(file_get_contents($filepath)); |
||
| 40 | if ($object === false) { |
||
| 41 | throw PersistenceException::cantUnserialize(basename($filepath)); |
||
| 42 | } |
||
| 43 | |||
| 44 | return $object; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |