Conditions | 3 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public static function readFileContent(string $path): string |
||
23 | { |
||
24 | try { |
||
25 | $file = new \SplFileObject($path, 'r'); |
||
26 | $content = $file->fread($file->getSize()); |
||
27 | if ($content === false) { |
||
28 | throw new \RuntimeException('content read error'); |
||
29 | } |
||
30 | |||
31 | return $content; |
||
32 | } catch (\Exception $e) { |
||
33 | throw FileIOException::readError($path, $e); |
||
34 | } |
||
56 |