]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/request/class_HttpRequest.php
Fake class names added, insertDataSet() stub added, dataset criteria added
[shipsimu.git] / inc / classes / main / request / class_HttpRequest.php
index 635b0fd9c18b616c93eda79b7eb64408375890dc..820a27ac1a048edfe5db36bfa50a3270bcfc39b6 100644 (file)
@@ -3,10 +3,10 @@
  * A concrete HTTP request class to make HTTP requests more abstract
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
- * @version            0.3.0
+ * @version            0.0.0
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.mxchange.org
+ * @link               http://www.ship-simu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class HttpRequest extends BaseFrameworkSystem implements Requestable {
+class HttpRequest extends BaseFrameworkSystem implements Requestable, Iterateable {
        /**
         * Array for the request data
         */
        private $requestData = array();
 
        /**
-        * Private constructor
+        * 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
         *
         * @return      void
         */
-       private final function __construct () {
+       protected function __construct () {
                // Call parent constructor
-               parent::constructor(__CLASS__);
+               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
         *
@@ -145,6 +163,34 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable {
                // Return the value
                return $headerValue;
        }
+
+       /**
+        * Getter for request method. This getter might be useful for security filters
+        *
+        * @return      $requestMethod  Used request method
+        */
+       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]