summaryrefslogtreecommitdiff
path: root/framework/Collections/TAttributeCollection.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/Collections/TAttributeCollection.php
parent265b7e85766ba403ca0a8b58648dd091e483cf38 (diff)
Modified TList and TMap implementation so that they can be more easily extended.
Diffstat (limited to 'framework/Collections/TAttributeCollection.php')
-rw-r--r--framework/Collections/TAttributeCollection.php50
1 files changed, 46 insertions, 4 deletions
diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php
index c8870919..abeb3c53 100644
--- a/framework/Collections/TAttributeCollection.php
+++ b/framework/Collections/TAttributeCollection.php
@@ -54,7 +54,6 @@ class TAttributeCollection extends TMap
*/
public function __get($name)
{
- $name=strtolower($name);
return $this->contains($name)?$this->itemAt($name):parent::__get($name);
}
@@ -68,7 +67,52 @@ class TAttributeCollection extends TMap
*/
public function __set($name,$value)
{
- $this->add(strtolower($name),$value);
+ $this->add($name,$value);
+ }
+
+ /**
+ * Returns the item with the specified key.
+ * This overrides the parent implementation by converting the key to lower case first.
+ * @param mixed the key
+ * @return mixed the element at the offset, null if no element is found at the offset
+ */
+ public function itemAt($key)
+ {
+ return parent::itemAt(strtolower($key));
+ }
+
+
+ /**
+ * Adds an item into the map.
+ * This overrides the parent implementation by converting the key to lower case first.
+ * @param mixed key
+ * @param mixed value
+ */
+ public function add($key,$value)
+ {
+ parent::add(strtolower($key),$value);
+ }
+
+ /**
+ * Removes an item from the map by its key.
+ * This overrides the parent implementation by converting the key to lower case first.
+ * @param mixed the key of the item to be removed
+ * @return mixed the removed value, null if no such key exists.
+ */
+ public function remove($key)
+ {
+ return parent::remove(strtolower($key));
+ }
+
+ /**
+ * Returns whether the specified is in the map.
+ * This overrides the parent implementation by converting the key to lower case first.
+ * @param mixed the key
+ * @return boolean whether the map contains an item with the specified key
+ */
+ public function contains($key)
+ {
+ return parent::contains(strtolower($key));
}
/**
@@ -80,7 +124,6 @@ class TAttributeCollection extends TMap
*/
public function hasProperty($name)
{
- $name=strtolower($name);
return $this->contains($name) || parent::hasProperty($name);
}
@@ -93,7 +136,6 @@ class TAttributeCollection extends TMap
*/
public function canGetProperty($name)
{
- $name=strtolower($name);
return $this->contains($name) || parent::canGetProperty($name);
}