Conditions | 4 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | public function save(string $classDir, string $aopClassName): string |
||
34 | { |
||
35 | $flatName = str_replace('\\', '_', $aopClassName); |
||
36 | $filename = sprintf('%s/%s.php', $classDir, $flatName); |
||
37 | $tmpFile = tempnam(dirname($filename), 'swap'); |
||
38 | if (is_string($tmpFile) && file_put_contents($tmpFile, $this->code) && rename($tmpFile, $filename)) { |
||
39 | return $filename; |
||
40 | } |
||
41 | |||
42 | // @codeCoverageIgnoreStart |
||
43 | @unlink((string) $tmpFile); |
||
|
|||
44 | |||
45 | throw new NotWritableException(sprintf('swap: %s, file: %s', $tmpFile, $filename)); |
||
46 | |||
50 |
If you suppress an error, we recommend checking for the error condition explicitly: