| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | 3 | public function getExtensions(string $mimeType): array |
|
| 38 | { |
||
| 39 | 3 | $lowerMime = strtolower(trim($mimeType)); |
|
| 40 | 3 | $extensions = self::EXTENSIONS[$lowerMime] ?? self::EXTENSIONS[$mimeType] ?? []; |
|
| 41 | |||
| 42 | 3 | if ($this->extensions) { |
|
|
|
|||
| 43 | 2 | $customExtensions = $this->extensions[$lowerMime] ?? $this->extensions[$mimeType] ?? []; |
|
| 44 | 2 | $extensions = $customExtensions ? array_unique(array_merge($customExtensions, $extensions)) : $extensions; |
|
| 45 | } |
||
| 46 | |||
| 47 | 3 | return $extensions; |
|
| 48 | } |
||
| 74 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.