Request.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. * Request object.
  13. *
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. *
  16. * @api
  17. */
  18. class Request
  19. {
  20. protected $uri;
  21. protected $method;
  22. protected $parameters;
  23. protected $files;
  24. protected $cookies;
  25. protected $server;
  26. protected $content;
  27. /**
  28. * Constructor.
  29. *
  30. * @param string $uri The request URI
  31. * @param string $method The HTTP method request
  32. * @param array $parameters The request parameters
  33. * @param array $files An array of uploaded files
  34. * @param array $cookies An array of cookies
  35. * @param array $server An array of server parameters
  36. * @param string $content The raw body data
  37. *
  38. * @api
  39. */
  40. public function __construct($uri, $method, array $parameters = array(), array $files = array(), array $cookies = array(), array $server = array(), $content = null)
  41. {
  42. $this->uri = $uri;
  43. $this->method = $method;
  44. $this->parameters = $parameters;
  45. $this->files = $files;
  46. $this->cookies = $cookies;
  47. $this->server = $server;
  48. $this->content = $content;
  49. }
  50. /**
  51. * Gets the request URI.
  52. *
  53. * @return string The request URI
  54. *
  55. * @api
  56. */
  57. public function getUri()
  58. {
  59. return $this->uri;
  60. }
  61. /**
  62. * Gets the request HTTP method.
  63. *
  64. * @return string The request HTTP method
  65. *
  66. * @api
  67. */
  68. public function getMethod()
  69. {
  70. return $this->method;
  71. }
  72. /**
  73. * Gets the request parameters.
  74. *
  75. * @return array The request parameters
  76. *
  77. * @api
  78. */
  79. public function getParameters()
  80. {
  81. return $this->parameters;
  82. }
  83. /**
  84. * Gets the request server files.
  85. *
  86. * @return array The request files
  87. *
  88. * @api
  89. */
  90. public function getFiles()
  91. {
  92. return $this->files;
  93. }
  94. /**
  95. * Gets the request cookies.
  96. *
  97. * @return array The request cookies
  98. *
  99. * @api
  100. */
  101. public function getCookies()
  102. {
  103. return $this->cookies;
  104. }
  105. /**
  106. * Gets the request server parameters.
  107. *
  108. * @return array The request server parameters
  109. *
  110. * @api
  111. */
  112. public function getServer()
  113. {
  114. return $this->server;
  115. }
  116. /**
  117. * Gets the request raw body data.
  118. *
  119. * @return string The request raw body data.
  120. *
  121. * @api
  122. */
  123. public function getContent()
  124. {
  125. return $this->content;
  126. }
  127. }