Question

I am trying to compare two PHP projects using PHP Depend (http://pdepend.org). One is a page-based PHP application written by a group of students a year ago and the second is mine that I have worked on for the past year. The objective is to provide some quantitative statistics that might help validate that refactoring the project (introducing a MVC architecture and lots of refactoring to better apply OO principles) has led to lower complexity and coupling, among others.

The problem I am facing is that when analyzing the older project, PHP depend ignores the files that were written in a procedural programming style. It only picks up those files that have classes defined. I am not sure why the previous students chose to have this hybrid style of writing code but they did.

Is this how PHP Depend works or is there some setting I can use so that it analyzes all files. The site offers little help. If PHP Depend can only analyze files with defined classes and methods, how can I generate some code metrics to validate my project?

Was it helpful?

Solution

Actually, PHP depends will generate empty reports for file that do not contain at least a class or a function. This is sadly the expected behavior before someone decides to patch it up.

You can use PHP LoC, PHP Mess Detector or PHP Code Sniffer to generate some code metrics for both projects. At least PHP LoC will generate all its metrics for unstructured php files, and PHP Code Sniffer and PHP Mess Detector will generate at least some of their metrics.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top