Retrieves a node by key and subtree

Returns null if the node is not found.

@param mixed             $key  The key
@param RedBlackNode|null $node The subtree root

@return RedBlackNode|null
188788
protected function nodeGet($key, ?RedBlackNode $node): ?RedBlackNode
    {
        while ($node !== null) {
            $comp = $this->comparator->compare($key, $node->key());
            if ($comp < 0) {
                $node = $node->left();
            } elseif ($comp > 0) {
                $node = $node->right();
            } else {
                return $node;
            }
        }

        return null;
    }
1358305
protected function balanceOnInsert(RedBlackNode $node): RedBlackNode
    {
        if ($this->isRed($node->right()) && !$this->isRed($node->left())) {
            $node = $this->rotateLeft($node);
        }
        if ($this->isRed($node->left()) && $this->isRed($node->left()->left())) {
            $node = $this->rotateRight($node);
        }
        if ($this->isRed($node->left()) && $this->isRed($node->right())) {
            $this->flipColors($node);
        }
        $node->setSize(1 + $this->nodeSize($node->left()) + $this->nodeSize($node->right()));

        return $node;
    }
1283542
public function get($key)
    {
        $token = $this->instance->get($key);
        if (!empty($token)) {
            return $token;
        }

        return null;
    }
665904
public function get($key = null)
    {
        if (null === $key) {
            return $this->get;
        }

        return isset($this->get[$key]) ? $this->get[$key] : null;
    }
582042
public function getRaw($key = null){
        if(null === $key){
            return $this->_data;
        }
        else{
            return isset($this->_data[$key])?$this->_data[$key]:null;
        }
    }
1339425
protected function traverseNode(Node $node) : Node
    {
        foreach ($node->getSubNodeNames() as $name) {
            $subNode =& $node->$name;

            if (\is_array($subNode)) {
                $subNode = $this->traverseArray($subNode);
                if ($this->stopTraversal) {
                    break;
                }
            } elseif ($subNode instanceof Node) {
                $traverseChildren = true;
                foreach ($this->visitors as $visitor) {
                    $return = $visitor->enterNode($subNode, $traverseChildren);
                    if (null !== $return) {
                        if ($return instanceof Node) {
                            $subNode = $return;
                        } elseif (self::DONT_TRAVERSE_CHILDREN === $return) {
                            $traverseChildren = false;
                        } elseif (self::STOP_TRAVERSAL === $return) {
                            $this->stopTraversal = true;
                            break 2;
                        } else {
                            throw new \LogicException(
                                'enterNode() returned invalid value of type ' . gettype($return)
                            );
                        }
                    }
                }

                if ($traverseChildren) {
                    $subNode = $this->traverseNode($subNode);
                    if ($this->stopTraversal) {
                        break;
                    }
                }

                foreach ($this->visitors as $visitor) {
                    $return = $visitor->leaveNode($subNode);
                    if (null !== $return) {
                        if ($return instanceof Node) {
                            $subNode = $return;
                        } elseif (self::STOP_TRAVERSAL === $return) {
                            $this->stopTraversal = true;
                            break 2;
                        } elseif (\is_array($return)) {
                            throw new \LogicException(
                                'leaveNode() may only return an array ' .
                                'if the parent structure is an array'
                            );
                        } else {
                            throw new \LogicException(
                                'leaveNode() returned invalid value of type ' . gettype($return)
                            );
                        }
                    }
                }
            }
        }

        return $node;
    }
1329900
public function getRaw($key)
    {
        if (isset(static::$relations[$key])) {
            return $this->getRelation($key);
        }

        return isset($this->values[$key]) ? $this->values[$key] : null;
    }
981609
protected function nodeRemoveRight($key, RedBlackNode $node): RedBlackNode
    {
        if (!$this->isRed($node->right()) && !$this->isRed($node->right()->left())) {
            $node = $this->moveRedRight($node);
        }
        if ($this->comparator->compare($key, $node->key()) === 0) {
            $link = $this->nodeMin($node->right());
            $node->setKey($link->key());
            $node->setValue($link->value());
            $node->setRight($this->nodeRemoveMin($node->right()));
        } else {
            $node->setRight($this->nodeRemove($key, $node->right()));
        }

        return $node;
    }
519744
protected function retrieve($key)
    {
        if (($cache = wincache_ucache_get($this->key . $key)) !== false) {
            return $cache;
        }

        return null;
    }
108315
private function checkAndTransformKey($key, $node)
    {
        if ('-' === $key || ($this->isIntegerKey($key) && (!is_array($node) || count($node)))) {
            if (!is_array($node) || $this->isAssociativeArray($node)) {
                throw new InvalidPathException(
                    sprintf('Used "%s" but array was not an array or is associative.', $key)
                );
            }
            $key = '-' === $key ? count($node) : (int) $key;
        }

        return $key;
    }
261462
protected function get($key)
    {
        $this->checkForNonEmptyKey($key);
        if (!$this->settingsHaveBeenRetrieved) {
            $this->retrieveSettings();
        }
        if (!isset($this->cachedSettings[$key])) {
            return null;
        }

        return $this->cachedSettings[$key];
    }
1009545
public function get($key)
    {
        if (!isset($this->records[$key])) {
            return null;
        }

        $record = $this->records[$key];

        if ($record['expire'] < time()) {
            unset($this->records[$key]);

            return null;
        }

        return $record['nodes'];
    }
466984
protected function nodeRemoveMax(RedBlackNode $node): ?RedBlackNode
    {
        if ($this->isRed($node->left())) {
            $node = $this->rotateRight($node);
        }

        if ($node->right() === null) {
            return null;
        }

        if (!$this->isRed($node->right()) && !$this->isRed($node->right()->left())) {
            $node = $this->moveRedRight($node);
        }

        $node->setRight($this->nodeRemoveMax($node->right()));

        return $this->balanceOnRemove($node);
    }
1218426
public function getkey($key, $cb = null)
    {
        $this->redis->get($this->config->redisprefix->value . $key, $cb);
    }
1209506
protected function moveRedLeft(RedBlackNode $node): RedBlackNode
    {
        $this->flipColors($node);
        if ($this->isRed($node->right()->left())) {
            $node->setRight($this->rotateRight($node->right()));
            $node = $this->rotateLeft($node);
            $this->flipColors($node);
        }

        return $node;
    }
1207279
public function findByKey(string $key) {
        if (!$this->root) {
            return null;
        }

        return $this->root->findByKey($key);
    }
1217361
private function cleanKey($node, $key)
    {
        if ($key === '') {
            $key = $node ? (string) count($node) : 0;
            // Found a [] key, so track this to ensure that we disable numeric
            // indexing of keys in the resolved query aggregator.
            $this->numericIndices = false;
        }

        return $key;
    }