PHP Класс Trismegiste\Mondrian\Transform\ReflectionContext

Responsible for maintaining a list of methods, traits, classes and interfaces used for building inheritance links in a digraph
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$inheritanceMap array the symbol map

Открытые методы

Метод Описание
__construct ( ) Build the context
addMethodToClass ( string $cls, string $method ) Add a method to its type with the current type for its default declaring type (after resolveSymbol, it changes)
findMethodInInheritanceTree ( string $cls, string $method ) : string Find if method is declared in superclass.
getClassesUsingTraitForDeclaringMethod ( string $fqcn, string $methodName ) : array Returns a list of all classes using a trait for declaring a given method
getDeclaringClass ( string $cls, string $meth ) : string Finds the FQCN of the first declaring class/interface of a method
hasDeclaringClass ( string $cls ) : boolean Search if a type (trait, class or interface) exists in the inheritanceMap
initClass ( $name )
initInterface ( $name )
initSymbol ( string $name, string $symbolType ) Initialize a new symbol
initTrait ( $name )
isInterface ( string $cls ) : boolean Is FQCN an interface ?
isTrait ( string $cls ) : boolean Is FQCN an interface ?
pushParentClass ( string $cls, string $parent ) Stacks a parent type for a type
pushUseTrait ( $cls, $useTrait )
resolveSymbol ( ) Resolve all methods inheritance, use by traits and declared

Защищенные методы

Метод Описание
resolveMethodDeclaration ( ) Construct the inheritanceMap of method by resolving which class or interface first declares a method
resolveTraitUse ( )

Приватные методы

Метод Описание
recursivDeclaration ( $current, $m )

Описание методов

__construct() публичный Метод

Build the context
public __construct ( )

addMethodToClass() публичный Метод

Add a method to its type with the current type for its default declaring type (after resolveSymbol, it changes)
public addMethodToClass ( string $cls, string $method )
$cls string
$method string

findMethodInInheritanceTree() публичный Метод

Note1: Algo is DFS Note2: Must be called AFTER resolveSymbol Note3: this one is kewl, I don't know why it works at the first try
public findMethodInInheritanceTree ( string $cls, string $method ) : string
$cls string
$method string
Результат string the class which first declares the method (or null)

getClassesUsingTraitForDeclaringMethod() публичный Метод

Returns a list of all classes using a trait for declaring a given method
public getClassesUsingTraitForDeclaringMethod ( string $fqcn, string $methodName ) : array
$fqcn string FQCN of trait
$methodName string the imported method
Результат array

getDeclaringClass() публичный Метод

Finds the FQCN of the first declaring class/interface of a method
public getDeclaringClass ( string $cls, string $meth ) : string
$cls string subclass name
$meth string method name
Результат string

hasDeclaringClass() публичный Метод

Search if a type (trait, class or interface) exists in the inheritanceMap
public hasDeclaringClass ( string $cls ) : boolean
$cls string
Результат boolean

initClass() публичный Метод

public initClass ( $name )

initInterface() публичный Метод

public initInterface ( $name )

initSymbol() публичный Метод

Initialize a new symbol
public initSymbol ( string $name, string $symbolType )
$name string class or interface name
$symbolType string one of SYMBOL_ const

initTrait() публичный Метод

public initTrait ( $name )

isInterface() публичный Метод

Is FQCN an interface ?
public isInterface ( string $cls ) : boolean
$cls string FQCN
Результат boolean

isTrait() публичный Метод

Is FQCN an interface ?
public isTrait ( string $cls ) : boolean
$cls string FQCN
Результат boolean

pushParentClass() публичный Метод

Stacks a parent type for a type
public pushParentClass ( string $cls, string $parent )
$cls string the type
$parent string the parent type of $cls

pushUseTrait() публичный Метод

public pushUseTrait ( $cls, $useTrait )

resolveMethodDeclaration() защищенный Метод

(not vey efficient algo, I admit), it sux, it's redundent, I don't like it
protected resolveMethodDeclaration ( )

resolveSymbol() публичный Метод

Resolve all methods inheritance, use by traits and declared
public resolveSymbol ( )

resolveTraitUse() защищенный Метод

protected resolveTraitUse ( )

Описание свойств

$inheritanceMap защищенное свойство

array the symbol map
protected $inheritanceMap