From c62323a40a833d991c091f8cd99bf9a4f29bfc6c Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 1 Aug 2006 12:27:41 +0000 Subject: Changed PHP minimum requirement to 5.1.0 --- framework/Collections/TList.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'framework/Collections/TList.php') 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 * - * 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 @@ -94,6 +93,16 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess return new TListIterator($this->_d); } + /** + * 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 */ -- cgit v1.2.3