There's currently a lot of code overlap and duplication in XML form field classes. That stems from being strictly PHP 5.3 only. We had to extend from the JFormField classes so as not to reinvent Joomla's wheel but we also had to implement the Interfaces to our own fields. Moreover, fields which inherited from each other in Joomla couldn't use the same inheritance in FOF, therefore we had to duplicate code (think of all the text-related fields...).
The solution is to go PHP 5.4+ only and use Traits. Refactoring field classes with traits lets us inherit from the Joomla classes and implement our functionality with Traits.
The only downside is that Traits cannot inherit from each other. This will require some clever use of layered Traits, each one defining one more method we can then combine in a method of our object. It's tortoises, no, Traits all the way down...
There's currently a lot of code overlap and duplication in XML form field classes. That stems from being strictly PHP 5.3 only. We had to extend from the JFormField classes so as not to reinvent Joomla's wheel but we also had to implement the Interfaces to our own fields. Moreover, fields which inherited from each other in Joomla couldn't use the same inheritance in FOF, therefore we had to duplicate code (think of all the text-related fields...).
The solution is to go PHP 5.4+ only and use Traits. Refactoring field classes with traits lets us inherit from the Joomla classes and implement our functionality with Traits.
The only downside is that Traits cannot inherit from each other. This will require some clever use of layered Traits, each one defining one more method we can then combine in a method of our object. It's tortoises, no, Traits all the way down...