Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function validateMediaItem(): bool |
||
19 | { |
||
20 | if (! $media = $this->getTemporaryUploadMedia()) { |
||
21 | return true; |
||
22 | } |
||
23 | |||
24 | if (empty($media->mime_type)) { |
||
25 | $extension = pathinfo($media->file_name, PATHINFO_EXTENSION); |
||
26 | |||
27 | return in_array($extension, $this->allowedExtensions); |
||
28 | } |
||
29 | |||
30 | $actualExtensions = (new MimeTypes())->getExtensions($media->mime_type); |
||
31 | |||
32 | return count(array_intersect($actualExtensions, $this->allowedExtensions)) > 0; |
||
33 | } |
||
42 |