When anaylzing php code with php depend you'll get a xml file with a lot of metrics for each package, class and method php found in your code. On the other hand having a single avarage value (for example the lines of code per method or the cyclomatic code complexity per method) over the whole project has no real significance.

So how can we cope with the huge amount of data php depend returns and read some interesting information from that?

I wrote an importer that extracts the data from the xml file and imports it into database records. Using my TYPO3 extension pt_list it is possible to browse throught the values, set filters, compare different xml summaries (or even projects) and have a look at some aggregates:

I will publish a "metrics playground" soon, so that you can play around with some data online.

But still this is not very convenient and won't tell you at first sight which piece of code is the one you should touch first.

So what I did is rendering the data into an alternate view (that restructures the data and converts it to json) and using the JavaScript InfoVis Toolkit the data will be rendered as a treemap. As too much data will slow down your browser I limited the data to the highest 200 elements and visualized the lines of code (loc) and the cyclomatic complexity (ccn) (of course every other value could be visualized the same way). The linked data are static exports, that could be easily integrated in a continous integration process as artifacts.

Hovering will show you the current value (ccn/loc) and clicking left will drill down to that specific method, while right-clicking will bring you back to the class, package or the whole project.

Have fun playing around with this. Any comment on this is welcome!


Fabrizio :)


This website uses disqus for the commenting functionality. In order to protect your privacy comments are disabled by default.

Enable Comments