The PVCollection class acts as a repository for data to be stored, retrieved and iterated over.
The collection class is a simple way of storing and getting information with key, value pairs, Any information can be stored and retrieved including strings, array, and objects. Some example use cases:
//Add data and increment over fit
$collection = new PVCollection();
$collection -> add('Apples');
$collection -> add('Oranges');
foreach($collection as $key => $value) {
echo $value;
}
package |
data |
---|
__construct(array $data = array()) : void
access |
public |
---|
array
An array of data
__get(string $index) : \$value
access |
public |
---|
string
An index/key that will be used to find the value, if present
\$value
The returned value if found in the index
add(mixed $data) : void
access |
public |
---|
mixed
Passed data can be an array, object and any other value.
addWithName(string $name, mixed $data) : void
access |
public |
---|
string
The name/index/key that will be associated with the passed value
mixed
The data the will be story associated with thhat key.
get(string $index)
see | \get |
---|---|
string
An index/key that will be used to find the value, if present
getData()
getIterator() : \PVIterator
remove(mixed $index) : void
access |
public |
---|
mixed
The index can either be a int or string
dataset :
count :