public function EasyRdf_Collection::getCollectionNode in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Collection.php \EasyRdf_Collection::getCollectionNode()
Get a node for a particular offset into the collection
This function may not return the item you requested, if it does not exist. Please check the $postion parameter returned.
If the offset is null, then the last node in the collection (before rdf:nil) will be returned.
Parameters
integer $offset The offset into the collection (or null):
Return value
array $node, $postion The node object and postion of the node
7 calls to EasyRdf_Collection::getCollectionNode()
- EasyRdf_Collection::append in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Collection.php - Append an item to the end of the collection
- EasyRdf_Collection::count in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Collection.php - Counts the number of items in the collection
- EasyRdf_Collection::offsetExists in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Collection.php - Array Access: check if a position exists in collection using array syntax
- EasyRdf_Collection::offsetGet in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Collection.php - Array Access: get an item at a specified position in collection using array syntax
- EasyRdf_Collection::offsetSet in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Collection.php - Array Access: set an item at a positon in collection using array syntax
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Collection.php, line 165
Class
- EasyRdf_Collection
- Sub-class of EasyRdf_Resource that represents an RDF collection (rdf:List)
Code
public function getCollectionNode($offset) {
$position = 1;
$node = $this;
$nil = $this->graph
->resource('rdf:nil');
while ($rest = $node
->get('rdf:rest') and $rest !== $nil and (is_null($offset) or $position < $offset)) {
$node = $rest;
$position++;
}
return array(
$node,
$position,
);
}