You are here

public function EasyRdf_Collection::offsetExists in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Collection.php \EasyRdf_Collection::offsetExists()

Array Access: check if a position exists in collection using array syntax

Example: isset($list[2])

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Collection.php, line 223

Class

EasyRdf_Collection
Sub-class of EasyRdf_Resource that represents an RDF collection (rdf:List)

Code

public function offsetExists($offset) {
  if (is_int($offset) and $offset > 0) {
    list($node, $position) = $this
      ->getCollectionNode($offset);
    return $node and $position === $offset and $node
      ->hasProperty('rdf:first');
  }
  else {
    throw new InvalidArgumentException("Collection offset must be a positive integer");
  }
}