amdp3-metaforums/Application/HTTP/Request.php

32 lines
827 B
PHP
Raw Permalink Normal View History

2019-11-18 13:33:45 +00:00
<?php
namespace Application\HTTP;
class Request {
private $data;
private $query;
public function __construct() {
$this->data = $_REQUEST;
2019-11-20 05:19:02 +00:00
$this->files = $_FILES;
2019-11-18 13:33:45 +00:00
$this->query = $_SERVER['QUERY_STRING'];
}
2019-11-20 05:19:02 +00:00
public function hasFile($name) {
return (array_key_exists($name,$this->files) && $this->files[$name]["name"] != "");
}
public function file($name) {
return new File($this->files[$name]);
}
2019-11-18 13:33:45 +00:00
function queryString() {
return $this->query;
}
function __get($prop) {
2019-11-20 05:19:02 +00:00
if(!array_key_exists($prop,$this->data)) return null;
2019-11-18 13:33:45 +00:00
return $this->data[$prop];
}
function __set($prop, $val) {
$this->data[$prop] = $val;
}
2019-11-20 05:19:02 +00:00
function __isset($prop) {
return array_key_exists($prop,$this->data);
}
2019-11-18 13:33:45 +00:00
}