Properties

$graph

$graph : 

Type

$currentClass

$currentClass : 

Type

$currentMethod

$currentMethod : 

Type

$namespace

$namespace : null|\Trismegiste\Mondrian\Visitor\PHPParser_Node_Name

Type

null|\Trismegiste\Mondrian\Visitor\PHPParser_Node_Name — Current namespace

$aliases

$aliases : array

Type

array — Currently defined namespace and class aliases

$currentPhpFile

$currentPhpFile : 

current file

Type

$currentClassVertex

$currentClassVertex : 

Type

$currentMethodNode

$currentMethodNode : 

Type

$reflection

$reflection : 

Type

$vertexDict

$vertexDict : 

Type

Methods

enterNode()

enterNode(\PHPParser_Node  $node) 

{@inheritDoc}

Parameters

\PHPParser_Node $node

leaveNode()

leaveNode(\PHPParser_Node  $node) 

{@inheritDoc}

Parameters

\PHPParser_Node $node

beforeTraverse()

beforeTraverse(array  $nodes) 

Parameters

array $nodes

getDeclaringClass()

getDeclaringClass(string  $cls, string  $meth) : string

Finds the FQCN of the first declaring class/interface of a method

Parameters

string $cls

subclass name

string $meth

method name

Returns

string

isInterface()

isInterface(string  $cls) : boolean

Is FQCN an interface ?

Parameters

string $cls

FQCN

Returns

boolean

isTrait()

isTrait(string  $cls) : boolean

Is FQCN a trait ?

Parameters

string $cls

FQCN

Returns

boolean

findVertex()

findVertex(string  $type, string  $key) : \Trismegiste\Mondrian\Graph\Vertex

Find a vertex by its type and name

Parameters

string $type
string $key

Returns

\Trismegiste\Mondrian\Graph\Vertex

or null

findAllMethodSameName()

findAllMethodSameName(  $method) 

See Context

Parameters

$method

existsVertex()

existsVertex(  $type,   $key) 

See Context

Parameters

$type
$key

findMethodInInheritanceTree()

findMethodInInheritanceTree(  $cls,   $method) 

Check if the class exists before searching for the declaring class of the method, because class could be unknown, outside or code could be bugged

Parameters

$cls
$method

getClassesUsingTraitForDeclaringMethod()

getClassesUsingTraitForDeclaringMethod(string  $cls,   $method) : array

Returns a list of all classes using a trait for declaring a given method

Parameters

string $cls

FQCN of trait

$method

Returns

array

logFallbackCall()

logFallbackCall(  $class,   $method,   $called) 

Parameters

$class
$method
$called

getExcludedCall()

getExcludedCall(  $class,   $method) 

Parameters

$class
$method

enterClassNode()

enterClassNode(\PHPParser_Node_Stmt_Class  $node) 

{@inheritDoc}

Parameters

\PHPParser_Node_Stmt_Class $node

enterInterfaceNode()

enterInterfaceNode(\PHPParser_Node_Stmt_Interface  $node) 

{@inheritDoc}

Parameters

\PHPParser_Node_Stmt_Interface $node

enterTraitNode()

enterTraitNode(\PHPParser_Node_Stmt_Trait  $node) 

Parameters

\PHPParser_Node_Stmt_Trait $node

enterPublicMethodNode()

enterPublicMethodNode(\PHPParser_Node_Stmt_ClassMethod  $node) 

{@inheritDoc}

Parameters

\PHPParser_Node_Stmt_ClassMethod $node

getCurrentMethodIndex()

getCurrentMethodIndex() : string

the vertex name for a MethodVertex

Returns

string

extractAnnotation()

extractAnnotation(\PHPParser_Node_Stmt  $node) 

Extracts annotations in the comment of a statement and injects them in attribute of the node

Parameters

\PHPParser_Node_Stmt $node

resolveClassName()

resolveClassName(\PHPParser_Node_Name  $src) : \PHPParser_Node_Name|\PHPParser_Node_Name_FullyQualified

resolve the Name with current namespace and alias

Parameters

\PHPParser_Node_Name $src

Returns

\PHPParser_Node_Name|\PHPParser_Node_Name_FullyQualified

getNamespacedName()

getNamespacedName(\PHPParser_Node  $node) : string

Helper : get the FQCN of the given $node->name

Parameters

\PHPParser_Node $node

Returns

string

findParamVertexIdx()

findParamVertexIdx(string  $className, string  $methodName, integer  $idx) : \Trismegiste\Mondrian\Visitor\ParamVertex

Find a ParamVertex by its [classname x mehodName x position]

Parameters

string $className
string $methodName
integer $idx

Returns

\Trismegiste\Mondrian\Visitor\ParamVertex

findTypeVertex()

findTypeVertex(string  $type) : \Trismegiste\Mondrian\Visitor\Vertex

Find a class or interface

Parameters

string $type

fqcn to be found

Returns

\Trismegiste\Mondrian\Visitor\Vertex

enterDeclaredMethodNode()

enterDeclaredMethodNode(\PHPParser_Node_Stmt_ClassMethod  $node, \Trismegiste\Mondrian\Transform\Vertex\MethodVertex  $signature) 

Process the method node and adding the vertex of the first declared method

Parameters

\PHPParser_Node_Stmt_ClassMethod $node
\Trismegiste\Mondrian\Transform\Vertex\MethodVertex $signature

enterImplementationNode()

enterImplementationNode(\PHPParser_Node_Stmt_ClassMethod  $node, \Trismegiste\Mondrian\Transform\Vertex\MethodVertex|null  $signature, string  $declaringClass) 

Process the implementation vertex with the method node

Parameters

\PHPParser_Node_Stmt_ClassMethod $node
\Trismegiste\Mondrian\Transform\Vertex\MethodVertex|null $signature

the first declaring method vertex

string $declaringClass

the first declaring class of this method

enterMethodCall()

enterMethodCall(\PHPParser_Node_Expr_MethodCall  $node) : void

Links the current implementation vertex to all methods with the same name. Filters on some obvious cases.

Parameters

\PHPParser_Node_Expr_MethodCall $node

enterStaticCall()

enterStaticCall(\PHPParser_Node_Expr_StaticCall  $node) 

Parameters

\PHPParser_Node_Expr_StaticCall $node

getCalledMethodVertexOn()

getCalledMethodVertexOn(string  $called, string  $method) : null|array

Try to find a signature to link with the method to call and the object against to

Parameters

string $called
string $method

Returns

null|array —

null if cannot determine vertex or an array of vertices (can be empty if no call must be made)

enterNonDynamicMethodCall()

enterNonDynamicMethodCall(\PHPParser_Node_Expr_MethodCall  $node) : void

Process of simple call of a method Sample: $obj->getThing($arg); Do not process : call_user_func(array($obj, 'getThing'), $arg); Do not process : $reflectionMethod->invoke($obj, 'getThing', $arg);

Parameters

\PHPParser_Node_Expr_MethodCall $node

enterNewInstance()

enterNewInstance(\PHPParser_Node_Expr_New  $node) 

Visits a "new" statement node

Add an edge from current implementation to the class which a new instance is created

Parameters

\PHPParser_Node_Expr_New $node

enterTraitUse()

enterTraitUse(\PHPParser_Node_Stmt_TraitUse  $node) 

Parameters

\PHPParser_Node_Stmt_TraitUse $node

enterInterfaceMethod()

enterInterfaceMethod(\PHPParser_Node_Stmt_ClassMethod  $node) 

Parameters

\PHPParser_Node_Stmt_ClassMethod $node

enterClassMethod()

enterClassMethod(\PHPParser_Node_Stmt_ClassMethod  $node) 

Parameters

\PHPParser_Node_Stmt_ClassMethod $node

enterTraitMethod()

enterTraitMethod(\PHPParser_Node_Stmt_ClassMethod  $node) 

Parameters

\PHPParser_Node_Stmt_ClassMethod $node