joomla/joomla-cms — pull request #5227 by Hackwar (2014-11-27 19:36:39+00:00)
Title: Implementing a tree node interface

### Goal
Currently we have a few constructs in our system that build a tree, but no proper interface for that. For example all menu items are forming a tree with nodes having a parent and children. Likewise with the categories and usergroups.
In the future, this interface should be implemented in those cases in order to provide developers with something to build on. For the moment, this would only be implemented in JCategoriesNode, further implementations would have to wait until Joomla 4.0, since they would break B/C.

### History
This PR is a result of the router changes that are currently being implemented. The idea is, that a generic router rule can work with data obtained by a specific component from its router and with this interface know what to do with it.

### Problems
My main issue right now is, if I have all bases covered or if I am forcing already too much unto future developers. I took JCategoriesNode as an example and removed what was category specific. I also removed the getSibbling() method, since I fear it is too much for a generic node interface/class. In JCategoriesNode this method is meant to allow navigation between sibbling categories and having simple arrows left and right on a category page to navigate between them.
While this interface implements all necessary methods for navigating between nodes, it does not provide means to enforce specific members of the class. From my POV we would need at least the class members $id, $title and $alias, but I would hate to create getters and setters for those simply because PHP does not support members in interfaces. So should this maybe even be an abstract class? That again would make this whole thing more difficult to adapt for third parties... Thoughts?

### Current Status
This PR is NOT ready for merging. It is meant for a place to discuss this idea and improve it. Right now I would not feel comfortable with this going into the core without some more thoughts by others.