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