summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/file/src/Validation/FileValidatorInterface.php
blob: c7ee762795cee491ac500aabbe520bdecfe499bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

namespace Drupal\file\Validation;

use Drupal\file\FileInterface;
use Symfony\Component\Validator\ConstraintViolationListInterface;

/**
 * Provides a file validator that supports a list of validations.
 */
interface FileValidatorInterface {

  /**
   * Validates a File with a list of validators.
   *
   * @param \Drupal\file\FileInterface $file
   *   The file to validate.
   * @param array $validators
   *   An associative array of validators with:
   *   - key: the plugin ID of the file validation constraint.
   *   - value: an associative array of options to pass to the constraint.
   *
   * @return \Symfony\Component\Validator\ConstraintViolationListInterface
   *   The violations list.
   */
  public function validate(FileInterface $file, array $validators): ConstraintViolationListInterface;

}