The Replacement process
The difficulty of extracting includes to their own classes depends on the number and complexity of the include
calls remaining in our class files. If there are very few includes and they are relatively simple, the process will be easy to complete. If there are many complex interdependent includes, the process will be relatively difficult to work through.
In general, the process is as follows:
- Search the
classes/
directory for aninclude
call in a class. - For that
include
call, search the entire codebase to find how many times the included file is used. - If the included file is used only once, and only in that one class:
- Copy the contents of the included file code as-is directly over the
include
call. - Test the modified class, and ...
- Copy the contents of the included file code as-is directly over the
Get Modernizing Legacy Applications in PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.