src/Collection/Tree/RedBlackSearchTree.php
protected function nodeFloor($key, ?RedBlackNode $node): ?RedBlackNode
    {
        if ($node === null) {
            return null;
        }

        $comp = $this->comparator->compare($key, $node->key());

        if ($comp === 0) {
            return $node;
        }
        if ($comp < 0) {
            return $this->nodeFloor($key, $node->left());
        }
        $right = $this->nodeFloor($key, $node->right());
        if ($right !== null) {
            return $right;
        }

        return $node;
    }
protected function nodeFloor($key, ?RedBlackNode $node): ?RedBlackNode
    {
        if ($node === null) {
            return null;
        }

        $comp = $this->comparator->compare($key, $node->key());

        if ($comp === 0) {
            return $node;
        }
        if ($comp < 0) {
            return $this->nodeFloor($key, $node->left());
        }
        $right = $this->nodeFloor($key, $node->right());
        if ($right !== null) {
            return $right;
        }

        return $node;
    }
protected function nodeFloor ( $ key , ? RedBlackNode $ node ) : ? RedBlackNode { if ( $ node === null ) { return null ; } $ comp = $ this -> comparator -> compare ( $ key , $ node -> key ( ) ) ; if ( $ comp === 0 ) { return $ node ; } if ( $ comp < 0 ) { return $ this -> nodeFloor ( $ key , $ node -> left ( ) ) ; } $ right = $ this -> nodeFloor ( $ key , $ node -> right ( ) ) ; if ( $ right !== null ) { return $ right ; } return $ node ; }
Retrieves the node with the largest key <= to a key in a subtree

Returns null if there is not a key less or equal to the given key.

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

@return RedBlackNode|null
Retrieves the node with the largest key < = to a key in a subtree