PHP Class SimpleReflection, simpletest

@package SimpleTest
Afficher le fichier Open project: simpletest/simpletest Class Usage Examples

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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

classExists() public méthode

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

classExistsSansAutoload() public méthode

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

classOrInterfaceExists() public méthode

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

classOrInterfaceExistsSansAutoload() public méthode

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

classOrInterfaceExistsWithAutoload() protected méthode

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.
Résultat boolean True if interface defined.

getFullSignature() protected méthode

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.
Résultat string Method signature up to last bracket.

getInterfaceMethods() public méthode

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

getInterfaces() public méthode

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

getMethods() public méthode

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

getParameterSignatures() protected méthode

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

getParent() public méthode

Finds the parent class name.
public getParent ( )

getSignature() public méthode

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

hasFinal() public méthode

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

isAbstract() public méthode

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

isAbstractMethod() protected méthode

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

isAbstractMethodInParents() protected méthode

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

isConstructor() protected méthode

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

isInterface() public méthode

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

isInterfaceMethod() protected méthode

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

isStaticMethod() protected méthode

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

onlyParents() protected méthode

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.
Résultat array List of parent interface names.

suppressSpurious() protected méthode

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