Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
45 | 5 | public function check(UploadedFileInterface $file): void |
|
46 | { |
||
47 | 5 | $extension = strtolower(pathinfo( |
|
48 | 5 | $file->getClientFilename() ?? '', |
|
49 | 5 | PATHINFO_EXTENSION |
|
50 | 5 | )); |
|
51 | |||
52 | 5 | if (!in_array($extension, $this->allowed, true)){ |
|
53 | 3 | throw new RuleException(sprintf($this->errorMessage, $extension)); |
|
54 | } |
||
57 |