BrokenPostRequestException.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Drupal\Core\Form\Exception;
  3. use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
  4. /**
  5. * Defines an exception used, when the POST HTTP body is broken.
  6. */
  7. class BrokenPostRequestException extends BadRequestHttpException {
  8. /**
  9. * The maximum upload size.
  10. *
  11. * @var string
  12. */
  13. protected $size;
  14. /**
  15. * Constructs a new BrokenPostRequestException.
  16. *
  17. * @param string $max_upload_size
  18. * The size of the maximum upload size.
  19. * @param string $message
  20. * The internal exception message.
  21. * @param \Exception $previous
  22. * The previous exception.
  23. * @param int $code
  24. * The internal exception code.
  25. */
  26. public function __construct($max_upload_size, $message = NULL, \Exception $previous = NULL, $code = 0) {
  27. parent::__construct($message, $previous, $code);
  28. $this->size = $max_upload_size;
  29. }
  30. /**
  31. * Returns the maximum upload size.
  32. *
  33. * @return string
  34. * A translated string representation of the size of the file size limit
  35. * based on the PHP upload_max_filesize and post_max_size.
  36. */
  37. public function getSize() {
  38. return $this->size;
  39. }
  40. }