public function EasyRdf_Collection::seek in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Collection.php \EasyRdf_Collection::seek()
Seek to a specific position in the container
The first item is postion 1
Parameters
integer $position The position in the container to seek to:
Throws
OutOfBoundsException
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Collection.php, line 73
Class
- EasyRdf_Collection
- Sub-class of EasyRdf_Resource that represents an RDF collection (rdf:List)
Code
public function seek($position) {
if (is_int($position) and $position > 0) {
list($node, $actual) = $this
->getCollectionNode($position);
if ($actual === $position) {
$this->position = $actual;
$this->current = $node;
}
else {
throw new OutOfBoundsException("Unable to seek to position {$position} in the collection");
}
}
else {
throw new InvalidArgumentException("Collection position must be a positive integer");
}
}