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