. namespace hoplite\http2; /*! A Request represents a HTTP request and holds the data and context associated with it. */ class Request { /*! @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 = []; /*! @var array Context data. */ public $context = []; /*! 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; } }