Analyzing all connections between functions
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!
精彩评论