Base collection, from which other collection classes derive.
This class provides the most basic collection, containing base objects. It has functionality to : - add objects - remove objects - set name of an object (rename) - get the names of all objects in the collection - get an object from the collection - get all objects in the collection - return number of objects in collection
| category | Core |
|---|---|
| package | Formaid |
| author | Dieter Adriaenssens |
| copyright | 2006-2013 Dieter Adriaenssens |
| license | GPL |
| link | http://formaid.sourceforge.net/ |
| todo | collections don't have a name, so when they are added as an object to another collection, they don't have an index by name in the array, which makes it impossible to use the index to track an object. Solution : don't depend on index (key), refactor all code to remove this, remove all functions that use the index by name, OR, give collections a name (implementing a ObjectInterface with getName() and setName() public methods) |
__construct() : void
add(object $obj) : void
If the object is of the Formaid_Object class, add it to the collection. If the object is not a class, create a new base object instance.
objectFormaid_Object instance or name of new Formaid_Object
display() : void
getDisplayListSeparator() : string
stringString separating columnsgetDisplayPrefix() : string
stringPrefix string when displaying collection itemsgetDisplayString() : string
A displaystring is generated from all objects in the collection, all empty strings are removed and the remaining ones are chained together with the listSeparator.
stringgetDisplaySuffix() : string
stringSuffix string when displaying collection itemsgetName(string $name) : string
stringobject name
stringobject namegetNames() : array
arrayobject namesgetObject(string $name) : object
stringobject name
objectgetObjects() : array
arrayobjectsisNameEmpty(string $name) : bool
stringobject name
booltrue if emptynumItems() : int
intnumber of objects in collectionremove(string $name) : void
stringobject name
setDisplayAffixes(string $prefix, string $suffix) : void
stringprefix string when displaying collection items
stringsuffix string when displaying collection items
setDisplayListSeparator(string $separator) : void
stringstring separating columns
setDisplayPrefix(string $prefix) : void
stringprefix string when displaying collection items
setDisplaySuffix(string $suffix) : void
stringsuffix string when displaying collection items
setName(string $name, string $new_name) : void
stringobject name
stringnew name
show() : void
The show method of every object is called. These functions print the object (name, value, ...) to stdout.
| deprecated | use display() |
|---|
addDisplayAffixes(string $displayString) : string
The pre- and suffix should only be displayed when at least one item is displayed.
stringString with collection items to be displayed
stringString with added affixescallbackDisplayString(object $object) : string
It calls the getDisplayString() method of the instance
| static |
|---|
objectInstance to apply the method to
stringDisplaystring of object$collection : array
| access | protected |
|---|
$_displayListSeparator : string
| access | private |
|---|
$_displayPrefix : string
| access | private |
|---|
$_displaySuffix : string
| access | private |
|---|