Comments (4)
You can check the code for other metrics https://github.com/pdepend/pdepend/tree/master/src/main/php/PDepend/Metrics/Analyzer
And you can propose a new one here with a pull-request.
from pdepend.
Hello @andrii-pukhalevych
To be honest I don't understand your question, can you explain it in more detail?
from pdepend.
Response for a class (RFC) is a number of methods in class + number of unique method calls of another classes.
The metric called the response for a class (RFC) measures the number of different methods that can be executed when an object of that class receives a message (when a method is invoked for that object). Ideally, we would want to find for each method of the class, the methods that class will call, and repeat this for each called method, calculating what is called the transitive closure of the method's call graph. This process can however be both expensive and quite inaccurate. In ckjm, we calculate a rough approximation to the response set by simply inspecting method calls within the class's method bodies. The value of RFC is the sum of number of methods called within the class's method bodies and the number of class's methods. This simplification was also used in the 1994 Chidamber and Kemerer description of the metrics.
from pdepend.
Hello, here is how you can get the number of public methods of a class:
function getNumberOfPublicMethods(\PDepend\Source\AST\ASTClass $class): int
{
return count(array_filter($class->getAllMethods(), function (\PDepend\Source\AST\ASTMethod $method) {
return $method->isPublic();
}));
}
Which is a relevant proxy for response for a class in PHP in my opinion. I think that's what other analyzers do.
from pdepend.
Related Issues (20)
- Halstead Volume Formula HOT 1
- PHP 8.3 syntax
- Values of hnd and hnt are mixed up in XML report HOT 1
- Critical Error: A compilation unit should contain at least one token HOT 3
- Typo in encoding name HOT 4
- Invalid characters passed to "octdec" HOT 1
- Compatibility Issue with Symfony/Config v7.0.0 in `getConfigTreeBuilder` Method HOT 10
- Broken Interface Type for Symfony\Component\Config\Definition\ConfigurationInterface::getConfigTreeBuilder HOT 2
- Missing .phar's HOT 1
- Major version 3.0.0 HOT 2
- Fail to parse throw exception in key offset access
- Trait method collision error for valid php file
- TooManyPublicMethods ignore exceptions HOT 1
- Use of "Parent" in namespace triggers "Unexpected token: Parent".
- Backed enum expects the type to be all lowercase HOT 2
- `Unexpected token: |` when using union typed constants HOT 4
- "Unexpected token: [" error when accessing array constant item HOT 2
- Cannot load xml namespace for validating config HOT 2
- FIlter pattern exclude regression HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdepend.