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