| Total Complexity | 3 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class JsHttpMimeDBMimeTypeProvider implements MimeTypeProvider |
||
| 8 | { |
||
| 9 | public function provideMimeTypes(): array |
||
| 10 | { |
||
| 11 | $result = []; |
||
| 12 | $aggregated = (string) @file_get_contents('https://raw.githubusercontent.com/jshttp/mime-db/master/db.json'); |
||
| 13 | |||
| 14 | foreach (json_decode($aggregated, true) as $mimeType => $information) { |
||
| 15 | /** @var string[] $extensions */ |
||
| 16 | $extensions = $information['extensions'] ?? []; |
||
| 17 | |||
| 18 | foreach ($extensions as $extension) { |
||
| 19 | $result[] = new MimeTypeForExtension($mimeType, $extension); |
||
| 20 | } |
||
| 21 | } |
||
| 22 | |||
| 23 | return $result; |
||
| 24 | } |
||
| 26 |