PHP Class SimpleReflection, simpletest

@package SimpleTest
Mostrar archivo Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
__construct ( string $interface ) Stashes the class/interface.
classExists ( ) : boolean Checks that a class has been declared.
classExistsSansAutoload ( ) : boolean Needed to kill the autoload feature in PHP5 for classes created dynamically.
classOrInterfaceExists ( ) : boolean Checks that a class or interface has been declared.
classOrInterfaceExistsSansAutoload ( ) : boolean Needed to kill the autoload feature in PHP5 for classes created dynamically.
getInterfaceMethods ( ) Gets the list of methods for the implemented interfaces only.
getInterfaces ( ) Gets the list of interfaces from a class.
getMethods ( ) Gets the list of methods on a class or interface.
getParent ( ) Finds the parent class name.
getSignature ( string $name ) : string Writes the source code matching the declaration of a method.
hasFinal ( ) Scans for final methods, as they screw up inherited mocks by not allowing you to override them.
isAbstract ( ) Trivially determines if the class is abstract.
isInterface ( ) Trivially determines if the class is an interface.

Protected Methods

Method Description
classOrInterfaceExistsWithAutoload ( string $interface, boolean $autoload ) : boolean Needed to select the autoload feature in PHP5 for classes created dynamically.
getFullSignature ( string $name ) : string For a signature specified in an interface, full details must be replicated to be a valid implementation.
getParameterSignatures ( ReflectionMethod $method ) : array Gets the source code for each parameter.
isAbstractMethod ( string $name ) : boolean Checks whether a method is abstract or not.
isAbstractMethodInParents ( string $name ) : boolean Checks whether a method is abstract in all parents or not.
isConstructor ( string $name ) : boolean Checks whether a method is the constructor.
isInterfaceMethod ( string $method ) Checks to see if the method signature has to be tightly specified.
isStaticMethod ( string $name ) : boolean Checks whether a method is static or not.
onlyParents ( array $interfaces ) : array Whittles a list of interfaces down to only the necessary top level parents.
suppressSpurious ( string $name ) : string The SPL library has problems with the Reflection library.

Method Details

__construct() public method

Stashes the class/interface.
public __construct ( string $interface )
$interface string Class or interface to inspect.

classExists() public method

Checks that a class has been declared.
public classExists ( ) : boolean
return boolean True if defined.

classExistsSansAutoload() public method

Needed to kill the autoload feature in PHP5 for classes created dynamically.
public classExistsSansAutoload ( ) : boolean
return boolean True if defined.

classOrInterfaceExists() public method

Checks that a class or interface has been declared.
public classOrInterfaceExists ( ) : boolean
return boolean True if defined.

classOrInterfaceExistsSansAutoload() public method

Needed to kill the autoload feature in PHP5 for classes created dynamically.
public classOrInterfaceExistsSansAutoload ( ) : boolean
return boolean True if defined.

classOrInterfaceExistsWithAutoload() protected method

Needed to select the autoload feature in PHP5 for classes created dynamically.
protected classOrInterfaceExistsWithAutoload ( string $interface, boolean $autoload ) : boolean
$interface string Class or interface name.
$autoload boolean True totriggerautoload.
return boolean True if interface defined.

getFullSignature() protected method

For a signature specified in an interface, full details must be replicated to be a valid implementation.
protected getFullSignature ( string $name ) : string
$name string Method name.
return string Method signature up to last bracket.

getInterfaceMethods() public method

Gets the list of methods for the implemented interfaces only.
public getInterfaceMethods ( )

getInterfaces() public method

If the class name is actually an interface then just that interface is returned.
public getInterfaces ( )

getMethods() public method

Gets the list of methods on a class or interface.
public getMethods ( )

getParameterSignatures() protected method

Gets the source code for each parameter.
protected getParameterSignatures ( ReflectionMethod $method ) : array
$method ReflectionMethod Method object from reflection API
return array List of strings, each a snippet of code.

getParent() public method

Finds the parent class name.
public getParent ( )

getSignature() public method

Writes the source code matching the declaration of a method.
public getSignature ( string $name ) : string
$name string Method name.
return string Method signature up to last bracket.

hasFinal() public method

Scans for final methods, as they screw up inherited mocks by not allowing you to override them.
public hasFinal ( )

isAbstract() public method

Trivially determines if the class is abstract.
public isAbstract ( )

isAbstractMethod() protected method

Checks whether a method is abstract or not.
protected isAbstractMethod ( string $name ) : boolean
$name string Method name.
return boolean true if method is abstract, else false

isAbstractMethodInParents() protected method

Checks whether a method is abstract in all parents or not.
protected isAbstractMethodInParents ( string $name ) : boolean
$name string Method name.
return boolean true if method is abstract in parent, else false

isConstructor() protected method

Checks whether a method is the constructor.
protected isConstructor ( string $name ) : boolean
$name string Method name.
return boolean true if method is the constructor

isInterface() public method

Trivially determines if the class is an interface.
public isInterface ( )

isInterfaceMethod() protected method

Checks to see if the method signature has to be tightly specified.
protected isInterfaceMethod ( string $method )
$method string Method name.

isStaticMethod() protected method

Checks whether a method is static or not.
protected isStaticMethod ( string $name ) : boolean
$name string Method name
return boolean true if method is static, else false

onlyParents() protected method

Whittles a list of interfaces down to only the necessary top level parents.
protected onlyParents ( array $interfaces ) : array
$interfaces array Reflection API interfaces to reduce.
return array List of parent interface names.

suppressSpurious() protected method

In particular, you can get extra characters in parameter names :(.
protected suppressSpurious ( string $name ) : string
$name string Parameter name.
return string Cleaner name.