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
ahhAverage Hierarchy Height The average of the maximum length from a root class to its deepest subclass subclassX
andcAverage Number of Derived Classes The average of direct subclasses of a classX
caAfferent Coupling Number of unique incoming dependencies from other artifacts of the same type.X
callsNumber of Method or Function CallsX
cboCoupling Between Objects Number of unique outgoing dependencies to other artifacts of the same type.X
ccnCyclomatic Complexity NumberXX
ccn2Extended Cyclomatic Complexity NumberXX
ceEfferent Coupling Number of unique outgoing dependencies to other artifacts of the same type.X
cisClass 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
crCode Rank Google PageRank applied on Packages and Classes. Classes with a high value should be tested frequently.XX
cszClass Size Number of methods and properties of a class: CSZ = NOM + VARS Measures the size of a class concerning operations and data.X
ditDepth of Inheritance Tree Depth of inheritance to root classX
elocExecutable Lines of CodeXXXX
fanoutNumber of Fanouts Referenced ClassesX
hbHalstead Bugs Estimated number of errors in the implementation HB = POW(HE, 2/3) / 3000X
hdHalstead Difficulty The difficulty of the program to write or understand, e.g. when doing code review HD = (n1 / 2) * (N2 / n2)X
heHalstead Effort Measures the amount of mental activity needed to translate the existing algorithm into implementation HE = HV * HDX
hiHalstead Intelligence Content Determines the amount of intelligence stated in the program HI = HV / HDX
hlHalstead Level HL = 1 / HDX
hndHalstead Vocabulary The total number of unique operator and unique operand occurrences HND = n1 + n2X
hntHalstead Length The total number of operator occurrences and the total number of operand occurrences HND = N1 + N2X
htHalstead Programming Time Shows time needed to translate the existing algorithm into implementation HT = HE / 18X
hvHalstead Volume Represents the size, in bits, of space necessary for storing the progream HV = N * log2(n)X
leafsNumber of Leaf Classes (final) classesX
llocLogical Lines Of CodeXXXX
locLines Of CodeXXXX
maxDITMax Depth of Inheritance Tree Maximum depth of inheritanceX
miMaintainability Index Calculates an index value between 0 and 100 that represents the relative ease of maintaining the codeX |
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
wmcWeighted Method Count The WMC metric is the sum of the complexities of all declared methods and constructors of class.X|
wmciInherited Weighted Method Count Same as wmc, but only inherited methods.X
wmcnpNon Private Weighted Method Count Same as wmc, but only non private methods.X