1 | <?php |
||
45 | class WebRequest extends RequestAbstract |
||
46 | { |
||
47 | const METHOD_GET = 'GET'; |
||
48 | const METHOD_POST = 'POST'; |
||
49 | const METHOD_PUT = 'PUT'; |
||
50 | const METHOD_DELETE = 'DELETE'; |
||
51 | |||
52 | /** |
||
53 | * @access protected |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $method; |
||
57 | |||
58 | /** |
||
59 | * @access protected |
||
60 | * @var string |
||
61 | */ |
||
62 | protected $requestedUrl; |
||
63 | |||
64 | /** |
||
65 | * @access protected |
||
66 | * @var array |
||
67 | */ |
||
68 | protected $headers; |
||
69 | |||
70 | /** |
||
71 | * @access protected |
||
72 | * @var string |
||
73 | */ |
||
74 | protected $protocol; |
||
75 | |||
76 | /** |
||
77 | * @access protected |
||
78 | * @var boolean |
||
79 | */ |
||
80 | protected $isSsl = false; |
||
81 | |||
82 | /** |
||
83 | * @access protected |
||
84 | * @var \Zepi\Turbo\FrameworkInterface\SessionInterface |
||
85 | */ |
||
86 | protected $session = null; |
||
87 | |||
88 | /** |
||
89 | * Constructs the object |
||
90 | * |
||
91 | * @access public |
||
92 | * @param string $method |
||
93 | * @param string $requestedUrl |
||
94 | * @param string $route |
||
95 | * @param array params |
||
96 | * @param string $base |
||
97 | * @param string $locale |
||
98 | * @param string $operatingSystem |
||
99 | * @param boolean $isSsl |
||
100 | * @param array $headers |
||
101 | * @param string $protocol |
||
102 | * @param array $data |
||
103 | */ |
||
104 | 21 | public function __construct($method, $requestedUrl, $route, $params, $base, $locale, $operatingSystem, $isSsl, $headers, $protocol, $data = array()) |
|
114 | |||
115 | /** |
||
116 | * Returns the method of the request |
||
117 | * |
||
118 | * @access public |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getMethod() |
||
125 | |||
126 | /** |
||
127 | * Returns the requested url |
||
128 | * |
||
129 | * @access public |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getRequestedUrl() |
||
136 | |||
137 | /** |
||
138 | * Returns the delimitier, which is used to split the route |
||
139 | * into parts. |
||
140 | * The delimiter for the html request is the slash (/). |
||
141 | * |
||
142 | * @access public |
||
143 | * @return string |
||
144 | */ |
||
145 | 3 | public function getRouteDelimiter() |
|
149 | |||
150 | /** |
||
151 | * Saves the given value for the given key in the session data |
||
152 | * |
||
153 | * @access public |
||
154 | * @param string $key |
||
155 | * @param mixed $value |
||
156 | */ |
||
157 | 1 | public function setSessionData($key, $value) |
|
161 | |||
162 | /** |
||
163 | * Returns the session value of the given key. |
||
164 | * |
||
165 | * @access public |
||
166 | * @param string $key |
||
167 | * @return mixed |
||
168 | */ |
||
169 | 3 | public function getSessionData($key = '') |
|
177 | |||
178 | /** |
||
179 | * Deletes the value for the given key |
||
180 | * |
||
181 | * @access public |
||
182 | * @param string $key |
||
183 | * @return boolean |
||
184 | */ |
||
185 | 2 | public function deleteSessionData($key) |
|
194 | |||
195 | /** |
||
196 | * Removes all session data |
||
197 | * |
||
198 | * @access public |
||
199 | */ |
||
200 | 1 | public function clearSessionData() |
|
206 | |||
207 | /** |
||
208 | * Returns the cookie value of the given key. |
||
209 | * |
||
210 | * @access public |
||
211 | * @param string $key |
||
212 | * @return mixed |
||
213 | */ |
||
214 | 2 | public function getCookieData($key = '') |
|
222 | |||
223 | /** |
||
224 | * Returns true if this request was made over a |
||
225 | * secure connection trough ssl. |
||
226 | * |
||
227 | * @access public |
||
228 | * @return boolean |
||
229 | */ |
||
230 | 1 | public function isSsl() |
|
234 | |||
235 | /** |
||
236 | * Adds a session object to the request |
||
237 | * |
||
238 | * @access public |
||
239 | * @param \Zepi\Turbo\FrameworkInterface\SessionInterface $session |
||
240 | * @return boolean |
||
241 | */ |
||
242 | 3 | public function setSession(SessionInterface $session) |
|
252 | |||
253 | /** |
||
254 | * Returns true if a session for the given name |
||
255 | * exists. Otherwise returns false. |
||
256 | * |
||
257 | * @access public |
||
258 | * @return boolean |
||
259 | */ |
||
260 | 2 | public function hasSession() |
|
268 | |||
269 | /** |
||
270 | * Returns the session |
||
271 | * |
||
272 | * @access public |
||
273 | * @return false|\Zepi\Turbo\FrameworkInterface\SessionInterface |
||
274 | */ |
||
275 | 3 | public function getSession() |
|
283 | |||
284 | /** |
||
285 | * Removes the session |
||
286 | * |
||
287 | * @access public |
||
288 | */ |
||
289 | 1 | public function removeSession() |
|
294 | |||
295 | /** |
||
296 | * Returns the value for the given header key |
||
297 | * |
||
298 | * @access public |
||
299 | * @param string $key |
||
300 | * @return false|mixed |
||
301 | */ |
||
302 | public function getHeader($key) |
||
310 | |||
311 | /** |
||
312 | * Returns an array with all headers |
||
313 | * |
||
314 | * @access public |
||
315 | * @return array |
||
316 | */ |
||
317 | public function getHeaders() |
||
321 | |||
322 | /** |
||
323 | * Returns the protocol of the request |
||
324 | * |
||
325 | * @access public |
||
326 | * @return string |
||
327 | */ |
||
328 | public function getProtocol() |
||
332 | } |
||
333 |