\Trismegiste\Mondrian\AnalysisHiddenCoupling

HiddenCoupling is an analyser which checks and finds hidden coupling between types

How ? This analyser searches for method calls. Everytime there is a call of a method against an object ( $obj->getThing() ), it means an edge from an implementation vertex where the call is to a method signature vertex.

Since "$obj" does not come from nowhere, its type (class or interface) must be known by the class owning the implementation vertex. In other words : If there is an edge from an implementation to a method, there must be at least one another directed path between these two vertices (through the class vertex, through a parameter vertex, superclass etc...) If you can't figure why, I recommand you to read the digraph language I've defined in this intent.

If there is none, maybe it means a hidden coupling. I add the "maybe" because, it's hard to find the type of "$obj" in soft-typed language like PHP. That's why there can be false positive. But it's easier to check false positives than to search through all over the php files to find that kind of weakness in the code.

One another thing, since I cannot detect calls from "call_user_func" and other magic features of PHP like "$obj->$methodName()" or "new $className" there is a big limit of this static analyser.

Neverthesless I pretend this tool can find at least 50% of hidden coupling in poorly-coded classes and about 10% of false positive, from what I've seen.

Summary

Methods
Properties
Constants
searchPath()
__construct()
addEdge()
addVertex()
getEdgeSet()
getVertexSet()
searchEdge()
getSuccessor()
getEdgeIterator()
getPartition()
createReducedGraph()
No public properties found
No constants found
recursivSearchPath()
resetVisited()
findOwningClassVertex()
findDeclaringVertex()
$stack
$graph
N/A
No private methods found
No private properties found
N/A

Properties

$stack

$stack : 

Type

$graph

$graph : 

Type

Methods

getEdgeSet()

getEdgeSet() : array

Get the edges set

Returns

array

getVertexSet()

getVertexSet() : array

Get the vertices in the graph

Returns

array

getSuccessor()

getSuccessor(\Trismegiste\Mondrian\Graph\Vertex  $v) : null|array

Get successors of a vertex

Parameters

\Trismegiste\Mondrian\Graph\Vertex $v

Returns

null|array —

null if the vertex is not in this graph

                    or an array of vertices

getEdgeIterator()

getEdgeIterator(\Trismegiste\Mondrian\Graph\Vertex  $v) : \Trismegiste\Mondrian\Graph\Iterator

Get an iterator on edges for one vertex

Parameters

\Trismegiste\Mondrian\Graph\Vertex $v

Returns

\Trismegiste\Mondrian\Graph\Iterator

getPartition()

getPartition() 

Returns a list of subgraph

recursivSearchPath()

recursivSearchPath(\SplObjectStorage  $step, \Trismegiste\Mondrian\Graph\Vertex  $dst) 

Parameters

\SplObjectStorage $step
\Trismegiste\Mondrian\Graph\Vertex $dst

resetVisited()

resetVisited() 

Reset visited state of edges