What tools are available for visualizing dependencies in a class (for example, for PHP)?

I am looking for an easy-to-use tool that can visualize the "internal work" of a class, written, for example, in PHP. What I would like to see are the different methods of the class and their relationship (method A calls method B, etc.). Is there such a tool for creating such a schedule? In the next step, perhaps there is a tool that also visualizes the "internal work" of the class (in the opposite direction) really, how the workflow works, that is, with all if-else solutions, etc. What methods are called in which case ?

If anyone can pass me such a tool (preferably for PHP and Python), I would appreciate it.

+4
source share
4 answers

Doxygen is a tool that can create documentation as well as call graphs from your code.

You can link to this page for more information: http://www.stack.nl/~dimitri/doxygen/manual/diagrams.html

I use this tool to create documentation diagrams and calls. it is very powerful, although the output depends on preference.

It supports several languages, such as C, Objective-C, C #, PHP, Java, Python, IDL (Corba, Microsoft and UNO / OpenOffice), Fortran, VHDL, Tcl, and to some extent D.

+1
source

Although many suggestions point to pycallgraph and phpcallgraph , I don’t think that they will do what you want to do - this is for runtime analysis, whereas it looks like you want to do static analysis.

I don’t know any tools for this, but considering that you are only interested in the work of one class and the relationships within this class, make a little effort so that you can crack something together into your choice of scripting language, which

  • Parses all function names and variable declarations within a class and stores them somewhere
  • Uses the information from step 1 to determine the use of variables, variable assignments and function calls, as well as the functions in which they occur.
  • Convert this information to the graph format used by dot , and then use the dot to create a directed graph showing the dependencies.

Given the effort, if the class is not too large, I will be tempted to just do it manually!

Good luck, and if you find a solution, you will really like it.

0
source

Have you looked at pycallgraph ?

Also, for runtime calls, you can run python code with cProfile and view it with GProfToDot

-1
source

Source: https://habr.com/ru/post/1485644/


All Articles