Chapter 4. Consolidate Classes and Functions

Now that we have an autoloader in place, we can begin to remove all the include calls that only load up class and function definitions. When we are done, the only remaining include calls will be those that are executing logic. This will make it easier to see which include calls are forming the logic paths in our legacy application, and which are merely providing definitions.

We will start with a scenario where the codebase is structured relatively well. Afterwards, we will answer some questions related to layouts that are not so amenable to revision.

Note

For the purposes of this chapter, we will use the term include to cover not just include but also require, include_once, and require_once.

Consolidate ...

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.