4

I would like to calculate some code metrics for my PHP OOP projects. I try to use some of the tools mentioned in here. But except trail version of Understand, which presents only

  • number of code, comment, blank lines
  • number of classes number of file
  • number of functions number of
  • declarative/executable statements

I couldn't find any working for PHP.

Plugin for Eclipse by State of Flow is not working with my (not so new) Galileo Eclipse v3.5.

I'm interested in measures such as

  • depth of inheritance tree,
  • avg function length,
  • weighted methods per class,
  • duplications,
  • ...

Are there any tools?

Community
  • 1
  • 1
Magda
  • 177
  • 3
  • 10

4 Answers4

11

There are some tools, in PHP -- and for PHP code.

Here are those I can think about :

  • phpcpd -- copy-paste detector
  • phploc -- to do many kind of counts (lines, classes, ...)
  • PHP_CodeSniffer -- to check if your code respects your coding standards.
  • phpmd -- mess detector
  • phpDocumentor / DocBlox to generate documentation (and detect what is not properly documented)


In PHP, those tools are generally not used from Eclipse, but integrated in some Continuous Integration Platform.

About those, you can take a look at :

Still, if you want to integrate some of those tools with Eclipse PDT, you might want to take a look at PHP Tool Integration.

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
2

See our PHP CloneDR for a tool that computes the amount and the precise location of duplicated code. It will find duplicates in spite of reformatting the text, modification of comments, and modifications (up to a degree of [dis]similarity.

There's an example of Joomla processed by the PHP CloneDR at the link.

Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
  • phpcpd does also find duplicates if you reformat code and comments. – cweiske Apr 30 '11 at 12:01
  • 1
    @cweiske: And who on earth will go through his big application and do that just to make phpcpd work? You don't need to do any manual labor like that to run the CloneDR. – Ira Baxter Apr 30 '11 at 13:35
2

to get complexity (and more, even estimated development time) you can use ProjectCodeMeter which supports PHP as well as other programming languages.

0

PHP Depend generates some nice metrics for you.

Nev Stokes
  • 9,051
  • 5
  • 42
  • 44