| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | private function handleSVGFile($file) |
||
| 32 | { |
||
| 33 | $handle = fopen($file->getPathname(), 'r+'); |
||
| 34 | $contents = fread($handle, filesize($file->getPathname())); |
||
| 35 | |||
| 36 | rewind($handle); |
||
| 37 | // Check if uploaded file is an SVG with starting XML declaration. |
||
| 38 | // If not then we add the XML declaration. |
||
| 39 | if (Str::startsWith($contents, '<svg')) { |
||
| 40 | fwrite($handle, $this->xmlDeclaration.PHP_EOL.$contents); |
||
| 41 | } |
||
| 42 | |||
| 43 | fclose($handle); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |