00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00016 final class HttpRequest
00017 {
00018
00019 private $get = array();
00020
00021
00022 private $post = array();
00023
00024
00025 private $server = array();
00026
00027
00028 private $cookie = array();
00029
00030
00031 private $session = array();
00032
00033
00034 private $files = array();
00035
00036
00037 private $attached = array();
00038
00039 private $headers = array();
00040
00041 private $method = null;
00042
00043 private $url = null;
00044
00048 public static function create()
00049 {
00050 return new self;
00051 }
00052
00053 public function &getGet()
00054 {
00055 return $this->get;
00056 }
00057
00058 public function getGetVar($name)
00059 {
00060 return $this->get[$name];
00061 }
00062
00063 public function hasGetVar($name)
00064 {
00065 return isset($this->get[$name]);
00066 }
00067
00071 public function setGet( $get)
00072 {
00073 $this->get = $get;
00074
00075 return $this;
00076 }
00077
00081 public function setGetVar($name, $value)
00082 {
00083 $this->get[$name] = $value;
00084 return $this;
00085 }
00086
00087 public function &getPost()
00088 {
00089 return $this->post;
00090 }
00091
00092 public function getPostVar($name)
00093 {
00094 return $this->post[$name];
00095 }
00096
00097 public function hasPostVar($name)
00098 {
00099 return isset($this->post[$name]);
00100 }
00101
00105 public function setPost( $post)
00106 {
00107 $this->post = $post;
00108
00109 return $this;
00110 }
00111
00115 public function setPostVar($name, $value)
00116 {
00117 $this->post[$name] = $value;
00118 return $this;
00119 }
00120
00121 public function &getServer()
00122 {
00123 return $this->server;
00124 }
00125
00126 public function getServerVar($name)
00127 {
00128 return $this->server[$name];
00129 }
00130
00131 public function hasServerVar($name)
00132 {
00133 return isset($this->server[$name]);
00134 }
00135
00139 public function setServer( $server)
00140 {
00141 $this->server = $server;
00142
00143 return $this;
00144 }
00145
00146 public function &getCookie()
00147 {
00148 return $this->cookie;
00149 }
00150
00151 public function getCookieVar($name)
00152 {
00153 return $this->cookie[$name];
00154 }
00155
00156 public function hasCookieVar($name)
00157 {
00158 return isset($this->cookie[$name]);
00159 }
00160
00164 public function setCookie( $cookie)
00165 {
00166 $this->cookie = $cookie;
00167
00168 return $this;
00169 }
00170
00171 public function &getSession()
00172 {
00173 return $this->session;
00174 }
00175
00176 public function getSessionVar($name)
00177 {
00178 return $this->session[$name];
00179 }
00180
00181 public function hasSessionVar($name)
00182 {
00183 return isset($this->session[$name]);
00184 }
00185
00189 public function setFiles( $files)
00190 {
00191 $this->files = $files;
00192
00193 return $this;
00194 }
00195
00196 public function &getFiles()
00197 {
00198 return $this->files;
00199 }
00200
00201 public function getFilesVar($name)
00202 {
00203 return $this->files[$name];
00204 }
00205
00206 public function hasFilesVar($name)
00207 {
00208 return isset($this->files[$name]);
00209 }
00210
00214 public function setSession( &$session)
00215 {
00216 $this->session = &$session;
00217
00218 return $this;
00219 }
00220
00224 public function setAttachedVar($name, $var)
00225 {
00226 $this->attached[$name] = $var;
00227
00228 return $this;
00229 }
00230
00234 public function getAttachedList()
00235 {
00236 return $this->getAttached();
00237 }
00238
00239 public function &getAttached()
00240 {
00241 return $this->attached;
00242 }
00243
00244 public function getAttachedVar($name)
00245 {
00246 return $this->attached[$name];
00247 }
00248
00252 public function unsetAttachedVar($name)
00253 {
00254 unset($this->attached[$name]);
00255
00256 return $this;
00257 }
00258
00259 public function hasAttachedVar($name)
00260 {
00261 return isset($this->attached[$name]);
00262 }
00263
00264 public function getByType(RequestType $type)
00265 {
00266 return $this->{$type->getName()};
00267 }
00268
00269 public function getHeaderList()
00270 {
00271 return $this->headers;
00272 }
00273
00274 public function hasHeaderVar($name)
00275 {
00276 return isset($this->headers[$name]);
00277 }
00278
00279 public function getHeaderVar($name)
00280 {
00281 return $this->headers[$name];
00282 }
00283
00287 public function unsetHeaderVar($name)
00288 {
00289 unset($this->headers[$name]);
00290 return $this;
00291 }
00292
00296 public function setHeaderVar($name, $var)
00297 {
00298 $this->headers[$name] = $var;
00299 return $this;
00300 }
00301
00305 public function setHeaders( $headers)
00306 {
00307 $this->headers = $headers;
00308 return $this;
00309 }
00310
00314 public function setMethod(HttpMethod $method)
00315 {
00316 $this->method = $method;
00317 return $this;
00318 }
00319
00323 public function getMethod()
00324 {
00325 return $this->method;
00326 }
00327
00331 public function setUrl(HttpUrl $url)
00332 {
00333 $this->url = $url;
00334 return $this;
00335 }
00336
00337 public function getUrl()
00338 {
00339 return $this->url;
00340 }
00341 }
00342 ?>