| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | final class Extension implements RuleInterface |
||
| 20 | { |
||
| 21 | private string $errorMessage; |
||
| 22 | private array $allowed = []; |
||
| 23 | |||
| 24 | 5 | public function __construct(string $errorMessage = null) |
|
| 25 | { |
||
| 26 | 5 | $this->errorMessage = $errorMessage ?? 'Files with the %s extension are not allowed'; |
|
| 27 | } |
||
| 28 | |||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string|string[] $extension |
||
| 32 | * @return $this |
||
| 33 | */ |
||
| 34 | 5 | public function allow(array|string $extension): Extension |
|
| 43 | } |
||
| 44 | |||
| 45 | 5 | public function check(UploadedFileInterface $file): void |
|
| 57 |