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