Beispiel #1
0
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Offset to retrieve
  * @link http://php.net/manual/en/arrayaccess.offsetget.php
  *
  * @param mixed $offset <p>
  * The offset to retrieve.
  * </p>
  *
  * @todo add support for Tree Based RidBags
  * @return ID The RecordID instance at the given offset.
  */
 public function offsetGet($offset)
 {
     if (isset($this->items[$offset])) {
         return $this->items[$offset];
     }
     if ($this->type === self::EMBEDDED) {
         $start = $this->baseOffset + $offset * 10;
         $cluster = Binary::unpackShort(substr($this->deserialized, $start, 2));
         $position = Binary::unpackLong(substr($this->deserialized, $start, 8));
         $this->items[$offset] = new ID($cluster, $position);
     } else {
         $this->items[$offset] = false;
     }
     return $this->items[$offset];
 }
 /**
  * Read a short from the socket.
  *
  * @return int the short read
  */
 protected function readShort()
 {
     return Binary::unpackShort($this->socket->read(2));
 }