PHP |
---|
class LJCCollectionBase |
It accomplishes this by implementing IteratorAggregate which provides "foreach" functionality and Countable which provides "count" functionality.
A strongly typed collection class would extend (inherit) from this base class and add an AddObject() method that would require the strongly typed object collection element. This is what makes the collection strongly typed.
The strongly typed collection class would also provide a Get() method that could retrieve the internal array element by key.
For an example of how this works, see class: LJCDBAccessLib-LJCDbColumns.AddItem | Adds an object and key value. |
GetItem | Get the item by Key value. |
Clear | _FunctionSummary_ |
GetKeys | Gets an indexed array of keys. |
GetValues | Gets an indexed array of objects. |
HasKey | Indicates if a key already exists. |
Remove | Remove the item by Key value. |
count | Allows Count(object). |
getIterator | Allows foreach() |
$Item | The elements array. |