Hi,
I would suggest breaking createRootNode() into two methods, createFirstRootNode() and addRootNode(). The API would be
function createFirstRootNode($values)
function addRootNode($values, $id, $_pos = 'AF') <--- also, shouldn't 'AF' be the constant NESE_MOVE_AFTER?
You needn't remove createRootNode(), but you should deprecate it in favor of these two new methods in the documentation, and make them a wrapper of createRootNode(). Optional parameters was a bad choice since they really aren't optional for the creation of a new tree, or for adding a root node to a tree.
Good point. I like this API suggestion.
I would also strongly encourage you to drop the explicit specification of a mode in _raiseError(). You needn't change any of the calls to _raiseError() immediately, but simply pass in null instead of $mode to PEAR::raiseError(). I don't like seeing packages controlling error handling, that is an application realm.
Daniel knows about this and will change that for future versions and/or 2.0 afaik.
This is a great package, I look forward to getting to know it intimately and pushing it around until it does what I need :)
It's a great package ;)
Arnaud.