/ LJCPHPCodeDoc / LJCCollectionLib / LJCCollectionBase


Syntax

PHP
class LJCCollectionBase

Represents a Collection of objects. Testing include of cr/lf.

Remarks

The LJCCollectionBase class provides the code that can be inherited to create a strongly typed Collection.

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.

Public Functions
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()
9 Functions

Public Properties
$Item The elements array.

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.