/** * (PHP 5 >= 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 long from the socket. * * @return int the integer read */ protected function readLong() { return Binary::unpackLong($this->socket->read(8)); }