Conditions | 4 |
Paths | 6 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function sanitizeFile(string $sourcePath, string $targetPath = null): void |
||
30 | { |
||
31 | if ($targetPath === null) { |
||
32 | $targetPath = $sourcePath; |
||
33 | } |
||
34 | $svg = file_get_contents($sourcePath); |
||
35 | if (!is_string($svg)) { |
||
|
|||
36 | return; |
||
37 | } |
||
38 | $sanitizedSvg = $this->sanitizeContent($svg); |
||
39 | if ($sanitizedSvg !== $svg) { |
||
40 | file_put_contents($targetPath, $sanitizedSvg); |
||
41 | } |
||
57 |