I'm profiling an app that has a boat load of functions in many files and I'm trying to isolate functions that don't get called ever.
Any ideas before I proceed?
I'm profiling an app that has a boat load of functions in many files and I'm trying to isolate functions that don't get called ever.
Any ideas before I proceed?
I don't believe there is an easy way to do this. print_r(get_defined_functions());
in a file that can be included at the end of every file or in a global. Collect the output and do searches on all your files for function calls. This will isolate out your functions.
Or
Move all the functions to an include file, comment out the functions and then allow the application to error. As you get errors for those functions un-comment the functions to resolve the errors. At the end of all your checks you'll have a list of commented functions that aren't utilized.
Either way it's not easy.
This should be easy if you're using an IDE that lets you search the entire project. Just Ctrl + F the function name with an opening bracket and if you only find one hit then you know the function is never called anywhere.
eg. Search for uselessfunction(
Otherwise you'll have to do this manually in each file.
Several links from http://qualityassuranceinphpprojects.com/pages/tools.html, namely
http://github.com/sebastianbergmann/phpcpd