summaryrefslogtreecommitdiff
path: root/framework/Web/THttpRequest.php
diff options
context:
space:
mode:
authorxue <>2006-01-31 00:01:49 +0000
committerxue <>2006-01-31 00:01:49 +0000
commit01bc363ac789cfb9d644ce82a949da5cd7e1c220 (patch)
treea059046856645d59cf0cb1badee83eb5c73671e9 /framework/Web/THttpRequest.php
parent265b7e85766ba403ca0a8b58648dd091e483cf38 (diff)
Modified TList and TMap implementation so that they can be more easily extended.
Diffstat (limited to 'framework/Web/THttpRequest.php')
-rw-r--r--framework/Web/THttpRequest.php42
1 files changed, 24 insertions, 18 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 2a3a35aa..ba626d07 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -140,7 +140,7 @@ class THttpRequest extends TMap implements IModule
$_COOKIE=$this->stripSlashes($_COOKIE);
}
- $this->copyfrom(array_merge($_GET,$_POST));
+ $this->copyFrom(array_merge($_GET,$_POST));
$this->_initialized=true;
$this->getApplication()->setRequest($this);
@@ -487,32 +487,38 @@ class THttpCookieCollection extends TList
}
/**
- * Adds the cookie if owner of this collection is of THttpResponse.
- * This method will be invoked whenever an item is added to the collection.
+ * Inserts an item at the specified position.
+ * This overrides the parent implementation by performing additional
+ * operations for each newly added THttpCookie object.
+ * @param integer the speicified position.
+ * @param mixed new item
+ * @throws TInvalidDataTypeException if the item to be inserted is not a THttpCookie object.
*/
- protected function addedItem($item)
+ public function insertAt($index,$item)
{
- if($this->_o instanceof THttpResponse)
- $this->_o->addCookie($item);
+ if($item instanceof THttpCookie)
+ {
+ parent::insertAt($index,$item);
+ if($this->_o instanceof THttpResponse)
+ $this->_o->addCookie($item);
+ }
+ else
+ throw new TInvalidDataTypeException('authorizationrulecollection_authorizationrule_required');
}
/**
- * Removes the cookie if owner of this collection is of THttpResponse.
- * This method will be invoked whenever an item is removed from the collection.
+ * Removes an item at the specified position.
+ * This overrides the parent implementation by performing additional
+ * cleanup work when removing a TCookie object.
+ * @param integer the index of the item to be removed.
+ * @return mixed the removed item.
*/
- protected function removedItem($item)
+ public function removeAt($index)
{
+ $item=parent::removeAt($index);
if($this->_o instanceof THttpResponse)
$this->_o->removeCookie($item);
- }
-
- /**
- * Restricts acceptable item of this collection to THttpCookie.
- * This method will be invoked whenever an item is to be added into the collection.
- */
- protected function canAddItem($item)
- {
- return ($item instanceof THttpCookie);
+ return $item;
}
}