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