| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | final class Validator |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Array of constraints |
||
| 13 | * |
||
| 14 | * @var ConstraintInterface[] |
||
| 15 | */ |
||
| 16 | protected $constraints = []; |
||
| 17 | |||
| 18 | public function __construct(array $constraints = []) |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Add a constraint |
||
| 25 | * @param ConstraintInterface $constraint |
||
| 26 | */ |
||
| 27 | public function addConstraint(ConstraintInterface $constraint): void |
||
| 28 | { |
||
| 29 | $this->constraints[] = $constraint; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Validate the file |
||
| 34 | * |
||
| 35 | * @param UploadedFile $file |
||
| 36 | * @return true |
||
| 37 | * @throws ConstraintException |
||
| 38 | */ |
||
| 39 | public function validate(UploadedFile $file): bool |
||
| 47 | } |
||
| 48 | } |
||
| 49 |