I have a code that highly relies on an
Array structure like the following:
$array['customer'][$customer_id]['details'][..]; // it goes to about 10 levels deep
However, after almost two years since the initial development, now I have to include another high-level element to that array which will make it something like this:
The challenge is that about 12,000 lines of source code are written by four programmers -- I'm the only one still working on the project, AND there is no unit tests, getters and setters, DI, etc. just a bare-bone MVC structure. So, changing the structure of that array will probably require 30% percent of methods to be modified to adapt with the new change, otherwise they just simply won't work as expected.
Is there any general approach for these kinda of headaches? Can I implement a method that could somehow bridge the gap?
I know the question is too vague without seeing the actual source code, however I highly appreciate any recommendations.
Currently I'm thinking of having a method/function which returns the legacy array, however you can actually pass the desired identifier and put it in a loop to get the same effect -- I'm not certain if it will work in all cases, but hopefully will fit in most cases:
$data = get_legacy_array( $company_id ); // Instead of: $data = $array['customer']...