| Conditions | 5 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 18 | public function detectMimeType(string $path, $contents): ?string |
|
| 33 | { |
||
| 34 | 18 | $mimeType = is_string($contents) |
|
| 35 | 12 | ? (@$this->finfo->buffer($contents) ?: null) |
|
| 36 | 18 | : null; |
|
| 37 | |||
| 38 | 18 | if ($mimeType !== null && ! in_array($mimeType, self::INCONCLUSIVE_MIME_TYPES)) { |
|
| 39 | 6 | return $mimeType; |
|
| 40 | } |
||
| 41 | |||
| 42 | 12 | return $this->detectMimeTypeFromPath($path); |
|
| 43 | } |
||
| 63 |