Giter Site home page Giter Site logo

Comments (4)

kylekatarnls avatar kylekatarnls commented on June 13, 2024 1

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.

tvbeek avatar tvbeek commented on June 13, 2024

Hello @andrii-pukhalevych

To be honest I don't understand your question, can you explain it in more detail?

from pdepend.

andrii-pukhalevych avatar andrii-pukhalevych commented on June 13, 2024

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.

kylekatarnls avatar kylekatarnls commented on June 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.