Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | protected function getMime(string $format): string |
||
28 | { |
||
29 | // Check if it's already MIME |
||
30 | if (str_contains($format, '/')) { |
||
31 | return $format; |
||
32 | } |
||
33 | |||
34 | $mime = (new MimeTypes())->getMimeType($format); |
||
35 | |||
36 | if (!isset($mime)) { |
||
37 | throw new \UnexpectedValueException("Format '$format' doesn't correspond with a MIME type"); |
||
38 | } |
||
39 | |||
40 | return $mime; |
||
41 | } |
||
77 |