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.
object
Formaid_Object instance or name of new Formaid_Object
display() : void
getDisplayListSeparator() : string
string
String separating columnsgetDisplayPrefix() : string
string
Prefix 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.
string
getDisplaySuffix() : string
string
Suffix string when displaying collection itemsgetName(string $name) : string
string
object name
string
object namegetNames() : array
array
object namesgetObject(string $name) : object
string
object name
object
getObjects() : array
array
objectsisNameEmpty(string $name) : bool
string
object name
bool
true if emptynumItems() : int
int
number of objects in collectionremove(string $name) : void
string
object name
setDisplayAffixes(string $prefix, string $suffix) : void
string
prefix string when displaying collection items
string
suffix string when displaying collection items
setDisplayListSeparator(string $separator) : void
string
string separating columns
setDisplayPrefix(string $prefix) : void
string
prefix string when displaying collection items
setDisplaySuffix(string $suffix) : void
string
suffix string when displaying collection items
setName(string $name, string $new_name) : void
string
object name
string
new 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.
string
String with collection items to be displayed
string
String with added affixescallbackDisplayString(object $object) : string
It calls the getDisplayString() method of the instance
static |
---|
object
Instance to apply the method to
string
Displaystring of object$collection : array
access | protected |
---|
$_displayListSeparator : string
access | private |
---|
$_displayPrefix : string
access | private |
---|
$_displaySuffix : string
access | private |
---|