Total Complexity | 8 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class MimeTypeConstraint implements ConstraintInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $errorMessageTemplate = 'File type {type} is invalid'; |
||
13 | |||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $allowedMimeTypes; |
||
18 | |||
19 | public function __construct(array $allowedMimeTypes) |
||
20 | { |
||
21 | $this->allowedMimeTypes = $allowedMimeTypes; |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc] |
||
26 | */ |
||
27 | public function validate(UploadedFile $file): bool |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function getErrorMessage(UploadedFile $file): string |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | public function setErrorMessage(string $messageTemplate): void |
||
56 |