O'Reilly logo

Modernizing Legacy Applications in PHP by Paul M. Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required