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:

  1. Search the classes/ directory for an include call in a class.
  2. For that include call, search the entire codebase to find how many times the included file is used.
  3. If the included file is used only once, and only in that one class:
    1. Copy the contents of the included file code as-is directly over the include call.
    2. Test the modified class, and ...

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.