Best way to dive into an existing complex php project
I have just inherited a huge mammoth php project, which is not quite organised. Few of the files are of 25K+ php lines of code. Several sections of code are redundant across the project. Several files are imported into several files... My job is to strip many of the unwanted features of this project. I am not a php guy, but I am comfortable with programming, so that should not be a problem.
Can you folks please tell me what should be my strategy to work with project?
I have the following in my mind.
(1) Use eclipse, to navigate around the project.
(2) Use Xdebug trace the execution and step into the code.
(3) Make Xdebug to dump the line numbers of code executed and write a shell script to extract those lines, so as to isolate the code required by me.
I request everyone to share there experience and strategies in such projects. At the end of the discussion, I would summaries the discussion so that anybody else can get the head start by just reading that.
Apart from XDebug, I've used log4php on occasions to just log an application's flow to a textfile. This will help you in making a map of the files/functions, and what is called in what order.
If you come across a piece of code that is repeated, make a new file and put the function there, in your own coding style and remove the others. Step by step rebuilding the code in your own style will help make things simpler in the end, in my experience anyway (whether it is function or OOP).
If not there already, implement decent fault handling and logging.