开发者

Analyzing all connections between functions

开发者 https://www.devze.com 2023-02-02 11:06 出处:网络
I\'m trying to analyze an OOP class. For example the class has a constructor that calls other methods and properties. Each method calls other methods or properties and so on. I\'m trying to study how

I'm trying to analyze an OOP class. For example the class has a constructor that calls other methods and properties. Each method calls other methods or properties and so on. I'm trying to study how all methods and properties relate to one another. I'm doing it by hand now. Is there a tool that could automate some of it? something that automatically analyzes how t开发者_开发知识库he functions call into one another and into the properties.


You can generate a "trace" - i.e. tree of all calls that certain run through code produces. There is xhprof, xdebug (free) or Zend Code Tracing ($$) that can do it. Statically it is quite hard to do it due to the dynamic nature of PHP, though there's phpCallGraph that could be helpful.


What you are talking about (as an output) is a sequence diagram.

You may be able to find tools to help if you search on that--apps can be profiled dynamically. I've done it with Java, the sequence diagrams that are generated are big but usable.


aptana studio version 3 beta (free), eclipse helios for php (free) and zend studio (free trial) has some functions like that. you right click a method call and click something like "go to definition" or similar. unfortunately they all loose track of objects quite fast, and can't understand what class the method is in, for example if the object is fetched from an array. but it's still a lot better than most other editor options!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号