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.
Metric | Description | Project | Package | File | Class | Method |
---|---|---|---|---|---|---|
ahh | Average Hierarchy Height The average of the maximum length from a root class to its deepest subclass subclass | X | ||||
andc | Average Number of Derived Classes The average of direct subclasses of a class | X | ||||
ca | Afferent Coupling Number of unique incoming dependencies from other artifacts of the same type. | X | ||||
calls | Number of Method or Function Calls | X | ||||
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 | ||||
cloc | Comment Lines of Code | X | X | X | X | |
clsa | Number of Abstract Classes | X | ||||
clsc | Number of Concrete Classes | X | ||||
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 | ||||
eloc | Executable Lines of Code | X | X | X | X | |
fanout | Number of Fanouts Referenced Classes | X | ||||
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) classes | X | ||||
lloc | Logical Lines Of Code | X | X | X | X | |
loc | Lines Of Code | X | X | X | X | |
maxDIT | Max Depth of Inheritance Tree Maximum depth of inheritance | X | ||||
mi | Maintainability Index Calculates an index value between 0 and 100 that represents the relative ease of maintaining the code | X | | ||||
noam | Number Of Added Methods | X | ||||
nocc | Number Of Child Classes | X | ||||
noom | Number Of Overwritten Methods | X | ||||
ncloc | Non Comment Lines Of Code | X | X | X | X | |
noc | Number Of Classes | X | X | |||
nof | Number Of Functions | X | X | |||
noi | Number Of Interfaces | X | X | |||
nom | Number Of Methods | X | X | X | ||
npm | Number of Public Methods | X | ||||
npath | NPath Complexity | X | ||||
nop | Number of Packages | X | ||||
rcr | Reverse Code Rank | X | X | |||
roots | Number of Root Classes | X | ||||
vars | Properties | X | ||||
varsi | Inherited Properties | X | ||||
varsnp | Non Private Properties | X | ||||
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 |