X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Frequest%2Fclass_HttpRequest.php;h=820a27ac1a048edfe5db36bfa50a3270bcfc39b6;hp=133f08af01be22137aa36049f467040b695bf785;hb=3cdaf6ce082d9e7a20cbeb06d525c28b3dd95c15;hpb=0b50907763979db50e24304d60bb507e3c2df790 diff --git a/inc/classes/main/request/class_HttpRequest.php b/inc/classes/main/request/class_HttpRequest.php index 133f08a..820a27a 100644 --- a/inc/classes/main/request/class_HttpRequest.php +++ b/inc/classes/main/request/class_HttpRequest.php @@ -21,12 +21,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class HttpRequest extends BaseFrameworkSystem implements Requestable { +class HttpRequest extends BaseFrameworkSystem implements Requestable, Iterateable { /** * Array for the request data */ private $requestData = array(); + /** + * Wether this request is valid and can be further processed. The default is + * valid so make sure your intercepting filters sets this attribute to false + * when they need to intercept the data flow. + */ + private $requestIsValid = true; + /** * Protected constructor * @@ -37,7 +44,7 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { parent::__construct(__CLASS__); // Set part description - $this->setObjectDescription("HTTP-Anfrage"); + $this->setObjectDescription("HTTP request"); // Create unique ID number $this->createUniqueID(); @@ -115,6 +122,17 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { return $value; } + /** + * Setter for request elements + * + * @param $element Request element to se + * @param $value Value to set + * @return void + */ + public function setRequestElement ($element, $value) { + $this->requestData[$element] = $value; + } + /** * Wrapper method for array_key() function for the request data array * @@ -154,6 +172,25 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { public final function getRequestMethod () { return $_SERVER['REQUEST_METHOD']; } + + /** + * Sets wether the request was valid (default: true) + * + * @param $isValid Wether the request is valid + * @return void + */ + public final function requestIsValid ($isValid = true) { + $this->requestIsValid = (bool) $isValid; + } + + /** + * Returns wether this request is valid + * + * @return $requestIsValid Wether this request is valid + */ + public final function isRequestValid () { + return $this->requestIsValid; + } } // [EOF]