Exemplo n.º 1
0
 public function getValue($key)
 {
     if ($this->storage !== null) {
         $this->storage->lock();
     }
     $root = $this->firstNode();
     if ($root === null) {
         return null;
     }
     $node = $this->search($root, $key);
     if ($node->valueType === 1) {
         $value = new Nodes();
         if ($this->storage !== null) {
             $value->setStorage($this->storage);
             $value->setHeadNodePointer($node->pointer);
         } else {
             $value->firstNode = $node->subNode;
         }
     } else {
         $value = $node->value;
     }
     if ($this->storage !== null) {
         $this->storage->unlock();
     }
     return $value;
 }