summaryrefslogtreecommitdiff
path: root/framework/Collections/TList.php
diff options
context:
space:
mode:
authorxue <>2006-08-01 12:27:41 +0000
committerxue <>2006-08-01 12:27:41 +0000
commitc62323a40a833d991c091f8cd99bf9a4f29bfc6c (patch)
tree9e03b4eb6cdbed4ea2ae9e105ae567977afff2a6 /framework/Collections/TList.php
parenta27e42c150fbc19eb848d1d1a73d1dddd713d48f (diff)
Changed PHP minimum requirement to 5.1.0
Diffstat (limited to 'framework/Collections/TList.php')
-rw-r--r--framework/Collections/TList.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php
index 015781cb..1104ec47 100644
--- a/framework/Collections/TList.php
+++ b/framework/Collections/TList.php
@@ -25,9 +25,8 @@
* unset($list[$index]); // remove the item at $index
* if(isset($list[$index])) // if the list has an item at $index
* foreach($list as $index=>$item) // traverse each item in the list
+ * $n=count($list); // returns the number of items in the list
* </code>
- * Note, count($list) will always return 1. You should use {@link getCount()}
- * to determine the number of items in the list.
*
* To extend TList by doing additional operations with each addition or removal
* operation, override {@link insertAt()}, and {@link removeAt()}.
@@ -37,7 +36,7 @@
* @package System.Collections
* @since 3.0
*/
-class TList extends TComponent implements IteratorAggregate,ArrayAccess
+class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable
{
/**
* internal data storage
@@ -95,6 +94,16 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess
}
/**
+ * Returns the number of items in the list.
+ * This method is required by Countable interface.
+ * @return integer number of items in the list.
+ */
+ public function count()
+ {
+ return $this->getCount();
+ }
+
+ /**
* @return integer the number of items in the list
*/
public function getCount()