summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/file/src/Upload/FileValidationException.php
blob: c5bc7b40dd52c9a1dda2349276d9fb031cb5c9f8 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php

namespace Drupal\file\Upload;

/**
 * Provides an exception for upload validation errors.
 */
class FileValidationException extends \RuntimeException {

  /**
   * The validation errors.
   *
   * @var array
   */
  protected $errors;

  /**
   * The file name.
   *
   * @var string
   */
  protected $fileName;

  /**
   * Constructs a new FileValidationException.
   *
   * @param string $message
   *   The message.
   * @param string $file_name
   *   The file name.
   * @param array $errors
   *   The validation errors.
   */
  public function __construct(string $message, string $file_name, array $errors) {
    parent::__construct($message, 0, NULL);
    $this->fileName = $file_name;
    $this->errors = $errors;
  }

  /**
   * Gets the file name.
   *
   * @return string
   *   The file name.
   */
  public function getFilename(): string {
    return $this->fileName;
  }

  /**
   * Gets the errors.
   *
   * @return array
   *   The errors.
   */
  public function getErrors(): array {
    return $this->errors;
  }

}