MimeTypeNotAllowed   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
1
<?php
2
3
namespace Spatie\MediaLibrary\Exceptions\FileCannotBeAdded;
4
5
use Spatie\MediaLibrary\Exceptions\FileCannotBeAdded;
6
7
class MimeTypeNotAllowed extends FileCannotBeAdded
8
{
9
    public static function create($file, array $allowedMimeTypes)
10
    {
11
        $mimeType = mime_content_type($file);
12
13
        $allowedMimeTypes = implode(', ', $allowedMimeTypes);
14
15
        return new static("File has a mimetype of {$mimeType}, while only {$allowedMimeTypes} are allowed");
16
    }
17
}
18