ProxyMethod
class ProxyMethod (View source)
Representation of a method within a proxy class
Constants
BEFORE_PARENT_CALL |
|
AFTER_PARENT_CALL |
|
Properties
protected string | $fullOriginalClassName | Fully qualified class name of the original class |
|
protected string | $methodName | Name of the original method |
|
protected string | $visibility | Visibility of the method |
|
protected string | $addedPreParentCallCode | ||
protected string | $addedPostParentCallCode | ||
protected string | $methodParametersCode | ||
string | $methodBody | ||
protected ReflectionService | $reflectionService |
Methods
Constructor
Overrides the method's visibility
Returns TRUE if this proxy belongs to a private method, otherwise FALSE
Adds PHP code to the body of this method which will be executed before a possible parent call.
Adds PHP code to the body of this method which will be executed after a possible parent call.
Sets the (exact) code which use used in as the parameters signature for this method.
Renders the PHP code for this Proxy Method
Tells if enough code was provided (yet) so that this method would actually be rendered if render() is called.
Builds the method documentation block for the specified method keeping the vital annotations
Builds the PHP code for the parameters of the specified method to be used in a method interceptor in the proxy class
Builds PHP code which calls the original (ie. parent) method after the added code has been executed.
Builds a string containing PHP code to build the array given as input.
Returns the method's visibility string found by the reflection service Note: If the reflection service has no information about this method, 'public' is returned.
Override the method body
Details
__construct(string $fullOriginalClassName, string $methodName)
Constructor
void
injectReflectionService(ReflectionService $reflectionService)
Injects the Reflection Service
void
overrideMethodVisibility(string $visibility)
Overrides the method's visibility
bool
isPrivate()
Returns TRUE if this proxy belongs to a private method, otherwise FALSE
void
addPreParentCallCode(string $code)
Adds PHP code to the body of this method which will be executed before a possible parent call.
void
addPostParentCallCode(string $code)
Adds PHP code to the body of this method which will be executed after a possible parent call.
void
setMethodParametersCode(string $code)
Sets the (exact) code which use used in as the parameters signature for this method.
string
render()
Renders the PHP code for this Proxy Method
bool
willBeRendered()
Tells if enough code was provided (yet) so that this method would actually be rendered if render() is called.
protected string
buildMethodDocumentation(string $className, string $methodName)
Builds the method documentation block for the specified method keeping the vital annotations
string
buildMethodParametersCode(string $fullClassName, string $methodName, bool $addTypeAndDefaultValue = true)
Builds the PHP code for the parameters of the specified method to be used in a method interceptor in the proxy class
protected string
buildCallParentMethodCode(string $fullClassName, string $methodName)
Builds PHP code which calls the original (ie. parent) method after the added code has been executed.
protected string
buildArraySetupCode(array $array)
Builds a string containing PHP code to build the array given as input.
protected string
getMethodVisibilityString()
Returns the method's visibility string found by the reflection service Note: If the reflection service has no information about this method, 'public' is returned.
void
setMethodBody(string $methodBody)
Override the method body