| Conditions | 6 |
| Paths | 5 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function getAll(): array |
||
| 23 | { |
||
| 24 | if ($this->cache) { |
||
| 25 | return $this->cache; |
||
| 26 | } |
||
| 27 | |||
| 28 | # Returns the system MIME type mapping of extensions to MIME types, as defined in /etc/mime.types. |
||
| 29 | $out = array(); |
||
| 30 | while (($line = fgets($this->file)) !== false) { |
||
| 31 | $line = trim(preg_replace('/#.*/', '', $line)); |
||
| 32 | if (!$line) { |
||
| 33 | continue; |
||
| 34 | } |
||
| 35 | $parts = preg_split('/\s+/', $line); |
||
| 36 | if (count($parts) == 1) { |
||
| 37 | continue; |
||
| 38 | } |
||
| 39 | $type = array_shift($parts); |
||
| 40 | foreach ($parts as $part) { |
||
| 41 | $out[$part] = $type; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | $this->cache = $out; |
||
| 46 | |||
| 47 | return $out; |
||
| 48 | } |
||
| 49 | |||
| 60 |