. namespace hoplite\http; require_once HOPLITE_ROOT . '/base/strict_object.php'; /*! A Request represents a HTTP request and holds the data and contexte associated with it. */ class Request extends \hoplite\base\StrictObject { /*! @var string The request method (upper case). */ public $http_method = NULL; /*! @var string The URL, relataive to the RootController. */ public $url = ''; /*! @var array HTTP request data. */ public $data = array(); /*! Constructor. Takes an optional URL. */ public function __construct($url = '') { $this->url = $url; } /*! Wrapper around filter_input() that stores the result in the ::$data field. */ public function Filter($type, $name, $filter=FILTER_SANITIZE_STRING, $options=NULL) { $rv = filter_input($type, $name, $filter, $options); $this->data[$name] = $rv; return $rv; } /*! Wrapper around filter_input() that merges the result in the ::$data field. */ public function FilterArray($type, $definition, $add_empty=TRUE) { $rv = filter_input_array($type, $definition, $add_empty); $this->data = array_merge($this->data, $rv); return $rv; } }