Purpose

The idea here is simple : transforms a bunch of php files with classes and make a digraph from it. With this, you can see where there is problem in your code.

What about UML ?

UML is good for creation and documentation but it does not show the coupling the way I want for building an relevant digraph. So I've made a new set of rules to build this directed graph with edges and vertices.

Vertices

So I have defined a new vocabulary to abstract source code :

  • Class : a class (also named as 'Type')
  • Interface : an interface (also named as 'Type')
  • Method : the method signature. A method is unique, even if it is overriden or redefined. The method is owned in the first 'type' which declares it.
  • Parameter : a parameter (or argument) from a method. Can be typed.
  • Implementation : the actual implementation of a method. If the method is concrete, the method owns the implementation. If the implementation is an overriden method, this is the class which owns the implementation.

Edges

And I have defined the appropriate grammar to abstract the coupling :

  • Inheritance : the daughter depends on the mother
  • Declaration : Class or Interface owns the method if there are the first to declare it.
  • Responsibility : Types or Methods own Implementations
  • Uses : An Implementation depends on parameters and its class
  • Calls : An implementation calls methods
  • Instantiation : An implementation creates a new object
  • Typing : A parameter depends on a Class or an Interface