if (!isset($this->requestData[$element])) {
// Then throw an exception
throw new MissingArrayElementsException(array($this, 'requestData', $element), self::EXCEPTION_MISSING_ELEMENT);
- }
+ } // END - if
// All clear
return true;
try {
if ($this->isRequestElementSet($element)) {
$value = $this->requestData[$element];
- }
+ } // END - if
} catch (MissingArrayElementsException $e) {
// Do nothing here
}
// Does this header exist?
if (isset($_SERVER[$name])) {
$headerValue = $_SERVER[$name];
- }
+ } // END - if
// Return the value
return $headerValue;
/**
* Sets wether the request was valid (default: true)
*
- * @param $isValid Wether the request is valid
+ * @param $isValid Wether the request is valid
* @return void
*/
public final function requestIsValid ($isValid = true) {
public final function isRequestValid () {
return $this->requestIsValid;
}
+
+ /**
+ * Reads a cookie and returns it's value or null if not found
+ *
+ * @param $cookieName Name of cookie we shall read
+ * @return $cookieValue Value of cookie or null if not found
+ */
+ public final function readCookie ($cookieName) {
+ // Default is no cookie with that name found
+ $cookieValue = null;
+
+ // Is the cookie set?
+ if (isset($_COOKIE[$cookieName])) {
+ // Then get it
+ $cookieValue = $_COOKIE[$cookieName];
+ } // END - if
+
+ // Return the value
+ return $cookieValue;
+ }
}
// [EOF]