32 lines
827 B
PHP
Raw Normal View History

2019-11-18 20:33:45 +07:00
<?php
namespace Application\HTTP;
class Request {
private $data;
private $query;
public function __construct() {
$this->data = $_REQUEST;
2019-11-20 12:19:02 +07:00
$this->files = $_FILES;
2019-11-18 20:33:45 +07:00
$this->query = $_SERVER['QUERY_STRING'];
}
2019-11-20 12:19:02 +07: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 20:33:45 +07:00
function queryString() {
return $this->query;
}
function __get($prop) {
2019-11-20 12:19:02 +07:00
if(!array_key_exists($prop,$this->data)) return null;
2019-11-18 20:33:45 +07:00
return $this->data[$prop];
}
function __set($prop, $val) {
$this->data[$prop] = $val;
}
2019-11-20 12:19:02 +07:00
function __isset($prop) {
return array_key_exists($prop,$this->data);
}
2019-11-18 20:33:45 +07:00
}