src/Collection/Tree/RedBlackSearchTree.php
protected function fillKeys(Queue $queue, $lo, $hi, ?RedBlackNode $node): void
    {
        if ($node === null) {
            return;
        }

        $complo = $this->comparator->compare($lo, $node->key());
        $comphi = $this->comparator->compare($hi, $node->key());

        if ($complo < 0) {
            $this->fillKeys($queue, $lo, $hi, $node->left());
        }
        if ($complo <= 0 && $comphi >= 0) {
            $queue->enqueue($node->key());
        }
        if ($comphi > 0) {
            $this->fillKeys($queue, $lo, $hi, $node->right());
        }
    }
protected function fillKeys(Queue $queue, $lo, $hi, ?RedBlackNode $node): void
    {
        if ($node === null) {
            return;
        }

        $complo = $this->comparator->compare($lo, $node->key());
        $comphi = $this->comparator->compare($hi, $node->key());

        if ($complo < 0) {
            $this->fillKeys($queue, $lo, $hi, $node->left());
        }
        if ($complo <= 0 && $comphi >= 0) {
            $queue->enqueue($node->key());
        }
        if ($comphi > 0) {
            $this->fillKeys($queue, $lo, $hi, $node->right());
        }
    }
protected function fillKeys ( Queue $ queue , $ lo , $ hi , ? RedBlackNode $ node ) : void { if ( $ node === null ) { return ; } $ complo = $ this -> comparator -> compare ( $ lo , $ node -> key ( ) ) ; $ comphi = $ this -> comparator -> compare ( $ hi , $ node -> key ( ) ) ; if ( $ complo < 0 ) { $ this -> fillKeys ( $ queue , $ lo , $ hi , $ node -> left ( ) ) ; } if ( $ complo <= 0 && $ comphi >= 0 ) { $ queue -> enqueue ( $ node -> key ( ) ) ; } if ( $ comphi > 0 ) { $ this -> fillKeys ( $ queue , $ lo , $ hi , $ node -> right ( ) ) ; } }
Fills a queue with keys between lo and hi in a subtree

@param Queue             $queue The queue
@param mixed             $lo    The lower bound
@param mixed             $hi    The upper bound
@param RedBlackNode|null $node  The subtree root

@return void
Fills a queue with keys between lo and hi in a subtree