I have a project where I develop a software which consists of a CORE which is in a separate project, developed separately, and a CLIENT which's base is the CORE but adds to the functionality with modules and whatnot. But also extends the System and other CORE classes. This is required because there are multiple SUBCLIENTs which's base is the CLIENT.
So the inheritance structure looks like the following: CORE -> CLIENT -> SUBCLIENT1, SUBCLIENT2, SUBCLIENT3...
What my goal is, whenever I update my CORE, it bubbles down to CLIENT and then to all SUBCLIENTS. And whenever I update the CLIENT, it bubbles down to SUBCLIENTS. This has been achieved, BUT there is a MANAGEMENT project which uses the CORE but NOT the CLIENT. Thus there are only 2 depths to that project.
My question is, how can I implement an inheritance structure which can handle as many depths as I want?
I give you an example:
There is currently this structure for the SystemBase class in a SUBCLIENT:
- (CORE) SystemBase.php
- (CLIENT) SystemClient.php (extends SystemBase)
- (SUBCLIENT) SystemVirtual.php (extends SystemClient)
This means that SystemBase has a basic functionality, upon which the SystemClient builds its own. But then on the third level, SystemVirtual adds modifications to these classes and their functionality. But what happens at Management? It would mean that SystemClient should not exist, because there are only 2 levels not 3.
But the problem is, I don't know how to write my System's structure so the CLIENT, MANAGEMENT and SUBCLIENTS can override it if needed. Because if I write my CORE to use SystemVirtual, then I hardcode 3 levels, and I can not inject more levels if needed.
I want my last level class to be used everywhere. Even in code written in the CORE which is level 1.
Any thoughts on the problem?
Thanks in advance!