PHP Depend - Software Metrics for PHP

Software metrics supported by PHP_Depend

PHP Depend can generate a large set of software metrics from a given code base, these values can be used to measure the quality of a software project and they help to identify that parts of an application where a refactoring should be applied.

This section will give a brief overview of the software metrics provided by PHP Depend and it tries to give an introduction how to interpret them in the context of an application's code base.

MetricDescriptionProjectPackageFileClassMethod
ahh Average Hierarchy Height The average of the maximum length from a root class to its deepest subclass subclassX
andc Average Number of Derived Classes The average of direct subclasses of a classX
ca Afferent Coupling Number of unique incoming dependencies from other artifacts of the same type. X
callsNumber of Method or Function CallsX
cbo Coupling Between Objects Number of unique outgoing dependencies to other artifacts of the same type. X
ccn Cyclomatic Complexity Number X X
ccn2 Extended Cyclomatic Complexity Number X X
ce Efferent Coupling Number of unique outgoing dependencies to other artifacts of the same type. X
cis Class Interface Size Number of non private methods and properties of a class: CIS = public(NOM + VARS) Measures the size of the interface from other parts of the system to a class. X
clocComment Lines of CodeXXXX
clsaNumber of Abstract ClassesX
clscNumber of Concrete ClassesX
cr Code Rank Google PageRank applied on Packages and Classes. Classes with a high value should be tested frequently. X X
csz Class Size Number of methods and properties of a class: CSZ = NOM + VARS Measures the size of a class concerning operations and data. X
dit Depth of Inheritance Tree Depth of inheritance to root class X
elocExecutable Lines of CodeXXXX
fanout Number of Fanouts Referenced ClassesX
hb Halstead Bugs Estimated number of errors in the implementation HB = POW(HE, 2/3) / 3000 X
hd Halstead Difficulty The difficulty of the program to write or understand, e.g. when doing code review HD = (n1 / 2) * (N2 / n2) X
he Halstead Effort Measures the amount of mental activity needed to translate the existing algorithm into implementation HE = HV * HD X
hi Halstead Intelligence Content Determines the amount of intelligence stated in the program HI = HV / HD X
hl Halstead Level HL = 1 / HD X
hnd Halstead Vocabulary The total number of unique operator and unique operand occurrences HND = n1 + n2 X
hnt Halstead Length The total number of operator occurrences and the total number of operand occurrences HND = N1 + N2 X
ht Halstead Programming Time Shows time needed to translate the existing algorithm into implementation HT = HE / 18 X
hv Halstead Volume Represents the size, in bits, of space necessary for storing the progream HV = N * log2(n) X
leafs Number of Leaf Classes (final) classesX
llocLogical Lines Of CodeXXXX
locLines Of CodeXXXX
maxDIT Max Depth of Inheritance Tree Maximum depth of inheritanceX
mi Maintainability Index Calculates an index value between 0 and 100 that represents the relative ease of maintaining the code X |
noamNumber Of Added MethodsX
noccNumber Of Child ClassesX
noomNumber Of Overwritten MethodsX
nclocNon Comment Lines Of CodeXXXX
nocNumber Of ClassesXX
nofNumber Of FunctionsXX
noiNumber Of InterfacesXX
nomNumber Of MethodsXXX
npmNumber of Public MethodsX
npathNPath ComplexityX
nopNumber of PackagesX
rcrReverse Code RankXX
rootsNumber of Root ClassesX
varsPropertiesX
varsiInherited PropertiesX
varsnpNon Private PropertiesX
wmc Weighted Method Count The WMC metric is the sum of the complexities of all declared methods and constructors of class. X |
wmci Inherited Weighted Method Count Same as wmc, but only inherited methods. X
wmcnp Non Private Weighted Method Count Same as wmc, but only non private methods. X