PhpAnalyzer
extends Base
in package
Statically Analyzes PHP code and collects data about class and interface usage and deflarations.
Table of Contents
- $classes : array<string|int, mixed>
- Declared classes.
- $interfaces : array<string|int, mixed>
- Declared classes.
- $usedDefinitions : array<string|int, mixed>
- array( $fulldefinitionname => array( $fullpath => array($linenr, ...), ... ) ).
- $usedFunctions : array<string|int, mixed>
- Function calls.
- $autoLoader : Autoloader
- The AutoLoader used to lookup the corresponding filename for the definitions.
- __call() : mixed
- Report that the $method doesn't exist.
- __callStatic() : mixed
- Report that the $method doesn't exist.
- __get() : mixed
- Report that $property doesn't exist.
- __set() : mixed
- Report that $property doesn't exist and set the property to the given $value.
- __toString() : string
- The object is used as an string.
- getInfo() : array<string|int, mixed>
- Extract definition information.
- getInfoWithReflection() : array<string|int, mixed>
- Use PHP's Reflection classes to extract definition information.
- open() : mixed
- Extract class and interface definitions from a file.
- setAutoLoader() : mixed
- Use the given $autoloader for resolving filenames.
- addCalledIn() : mixed
- Register that a function is called in $file on $line.
- addUsedIn() : mixed
- Register that a definition is used in $file on $line.
- getAutoLoader() : Autoloader
- Get the configured autoloader instance.
- prefixNamespace() : string
- Resolve the full classname.
Properties
$classes
Declared classes.
public
array<string|int, mixed>
$classes
= []
array( $fullclassname => array( 'namespace' => $namespace, 'class' => $classname, 'extends' => $fullsuperclass, 'implements' => array($interface, ...), 'methods' => array( $methodname => array( $parameter => $defaultvalue, ... ), ... ), 'filename' => $fullpath, ), ... ).
$interfaces
Declared classes.
public
array<string|int, mixed>
$interfaces
= []
array( $fullinterfacename => array( 'namespace' => $namespace, 'interface' => $interfacename, 'extends' => array($interface, ...), 'methods' => array( $methodname => array( $parameter => $defaultvalue, ... ), ... ), 'filename' => $fullpath, ), ... ).
$usedDefinitions
array( $fulldefinitionname => array( $fullpath => array($linenr, ...), ... ) ).
public
array<string|int, mixed>
$usedDefinitions
= []
$usedFunctions
Function calls.
public
array<string|int, mixed>
$usedFunctions
= []
$autoLoader
The AutoLoader used to lookup the corresponding filename for the definitions.
private
Autoloader
$autoLoader
Methods
__call()
Report that the $method doesn't exist.
public
__call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
- $method : string
- $arguments : array<string|int, mixed>
Return values
mixed —__callStatic()
Report that the $method doesn't exist.
public
static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
- $method : string
- $arguments : array<string|int, mixed>
Return values
mixed —__get()
Report that $property doesn't exist.
public
__get(string $property) : mixed
Parameters
- $property : string
Return values
mixed —__set()
Report that $property doesn't exist and set the property to the given $value.
public
__set(string $property, mixed $value) : mixed
Parameters
- $property : string
- $value : mixed
Return values
mixed —__toString()
The object is used as an string.
public
__toString() : string
Return values
string —getInfo()
Extract definition information.
public
getInfo(string $definition) : array<string|int, mixed>
Parameters
- $definition : string
Return values
array<string|int, mixed> —getInfoWithReflection()
Use PHP's Reflection classes to extract definition information.
public
getInfoWithReflection(string $definition) : array<string|int, mixed>
Parameters
- $definition : string
-
Class or Interace name
Return values
array<string|int, mixed> —open()
Extract class and interface definitions from a file.
public
open(string $filename) : mixed
Parameters
- $filename : string
-
Fullpath to the php-file.
Return values
mixed —setAutoLoader()
Use the given $autoloader for resolving filenames.
public
setAutoLoader(Autoloader $autoLoader) : mixed
Parameters
- $autoLoader : Autoloader
Return values
mixed —addCalledIn()
Register that a function is called in $file on $line.
private
addCalledIn(string $function, string $filename, int $line) : mixed
Parameters
- $function : string
-
The class/interface that is used
- $filename : string
-
The filename it is use in
- $line : int
-
The line number it is used on
Return values
mixed —addUsedIn()
Register that a definition is used in $file on $line.
private
addUsedIn(string $definition, string $filename, int $line) : mixed
Parameters
- $definition : string
-
The class/interface that is used
- $filename : string
-
The filename it is use in
- $line : int
-
The line number it is used on
Return values
mixed —getAutoLoader()
Get the configured autoloader instance.
private
getAutoLoader() : Autoloader
Return values
Autoloader —prefixNamespace()
Resolve the full classname.
private
prefixNamespace(string $namespace, string $identifier[, array<string|int, mixed> $uses = [] ]) : string
Parameters
- $namespace : string
-
Active namespace
- $identifier : string
-
The class or interface name
- $uses : array<string|int, mixed> = []
-
Active USE statements.