Medusa\Tree\PersistentAvlTree::removeCurrentNode PHP Метод

removeCurrentNode() приватный Метод

private removeCurrentNode ( )
    private function removeCurrentNode()
    {
        if ($this->right->isEmpty() && $this->left->isEmpty()) {
            return self::createEmpty();
        }
        if ($this->right->isEmpty() && !$this->left->isEmpty()) {
            return $this->left;
        }
        if (!$this->right->isEmpty() && !$this->left->isEmpty()) {
            return $this->right;
        }
        return $this->removeLastAndPlaceAtTheTop();
    }