summaryrefslogtreecommitdiff
path: root/framework/Collections/TMap.php
diff options
context:
space:
mode:
authorxue <>2006-08-02 02:24:29 +0000
committerxue <>2006-08-02 02:24:29 +0000
commit550ba06593b467b643862d41a00ca2dd12ee704b (patch)
tree16ad8180c2f0b96454453effff89dc236469ee4f /framework/Collections/TMap.php
parentccfa7850dc435ae9941cde18be827b3aac550f85 (diff)
merge from 3.0 branch till 1320.
Diffstat (limited to 'framework/Collections/TMap.php')
-rw-r--r--framework/Collections/TMap.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php
index e3a26e5f..ef393866 100644
--- a/framework/Collections/TMap.php
+++ b/framework/Collections/TMap.php
@@ -24,16 +24,15 @@
* unset($map[$key]); // remove the value with the specified key
* if(isset($map[$key])) // if the map contains the key
* foreach($map as $key=>$value) // traverse the items in the map
+ * $n=count($map); // returns the number of items in the map
* </code>
- * Note, count($map) will always return 1. You should use {@link getCount()}
- * to determine the number of items in the map.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
* @package System.Collections
* @since 3.0
*/
-class TMap extends TComponent implements IteratorAggregate,ArrayAccess
+class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
{
/**
* @var array internal data storage
@@ -85,6 +84,16 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess
}
/**
+ * Returns the number of items in the map.
+ * This method is required by Countable interface.
+ * @return integer number of items in the map.
+ */
+ public function count()
+ {
+ return $this->getCount();
+ }
+
+ /**
* @return integer the number of items in the map
*/
public function getCount()