Request.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\BrowserKit;
  11. /**
  12. * @author Fabien Potencier <fabien@symfony.com>
  13. */
  14. class Request
  15. {
  16. protected $uri;
  17. protected $method;
  18. protected $parameters;
  19. protected $files;
  20. protected $cookies;
  21. protected $server;
  22. protected $content;
  23. /**
  24. * @param string $uri The request URI
  25. * @param string $method The HTTP method request
  26. * @param array $parameters The request parameters
  27. * @param array $files An array of uploaded files
  28. * @param array $cookies An array of cookies
  29. * @param array $server An array of server parameters
  30. * @param string $content The raw body data
  31. */
  32. public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], string $content = null)
  33. {
  34. $this->uri = $uri;
  35. $this->method = $method;
  36. $this->parameters = $parameters;
  37. $this->files = $files;
  38. $this->cookies = $cookies;
  39. $this->server = $server;
  40. $this->content = $content;
  41. }
  42. /**
  43. * Gets the request URI.
  44. *
  45. * @return string The request URI
  46. */
  47. public function getUri()
  48. {
  49. return $this->uri;
  50. }
  51. /**
  52. * Gets the request HTTP method.
  53. *
  54. * @return string The request HTTP method
  55. */
  56. public function getMethod()
  57. {
  58. return $this->method;
  59. }
  60. /**
  61. * Gets the request parameters.
  62. *
  63. * @return array The request parameters
  64. */
  65. public function getParameters()
  66. {
  67. return $this->parameters;
  68. }
  69. /**
  70. * Gets the request server files.
  71. *
  72. * @return array The request files
  73. */
  74. public function getFiles()
  75. {
  76. return $this->files;
  77. }
  78. /**
  79. * Gets the request cookies.
  80. *
  81. * @return array The request cookies
  82. */
  83. public function getCookies()
  84. {
  85. return $this->cookies;
  86. }
  87. /**
  88. * Gets the request server parameters.
  89. *
  90. * @return array The request server parameters
  91. */
  92. public function getServer()
  93. {
  94. return $this->server;
  95. }
  96. /**
  97. * Gets the request raw body data.
  98. *
  99. * @return string The request raw body data
  100. */
  101. public function getContent()
  102. {
  103. return $this->content;
  104. }
  105. }