| Conditions | 3 |
| Paths | 7 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | public static function writeFileContent(string $path, string $content): void |
||
| 41 | { |
||
| 42 | try { |
||
| 43 | $len = strlen($content); |
||
| 44 | |||
| 45 | $file = new \SplFileObject($path, 'w'); |
||
| 46 | $file->rewind(); |
||
| 47 | if ($len !== $file->fwrite($content)) { |
||
| 48 | throw new \RuntimeException('content write error'); |
||
| 49 | } |
||
| 50 | $file->fflush(); |
||
| 51 | } catch (\Exception $e) { |
||
| 52 | throw FileIOException::writeError($path, $e); |
||
| 53 | } |
||
| 56 |