final class ProxyConstructorGenerator extends ProxyMethodGenerator (View source)

Properties

protected $addedPreParentCallCode from  ProxyMethodGenerator
protected $addedPostParentCallCode from  ProxyMethodGenerator
protected $attributesCode from  ProxyMethodGenerator
protected class-string|null $fullOriginalClassName from  ProxyMethodGenerator

Methods

fromReflection(MethodReflection $reflectionMethod)

No description

copyMethodSignatureAndDocblock(MethodReflection $reflectionMethod)

No description

string|null
getFullOriginalClassName()

No description

void
setFullOriginalClassName(string $fullOriginalClassName)

No description

void
addPreParentCallCode(string $code)

Adds PHP code to the body of this proxy method which will be executed before a possible parent call.

void
addPostParentCallCode(string $code)

Adds PHP code to the body of this proxy method which will be executed after a possible parent call.

string
generate()

Generates the code for the method.

string
renderBodyCode()

No description

bool
willBeRendered()

Tells if enough code was provided (yet) so that this method would actually be rendered if render() is called.

string
buildMethodParametersCode(string|null $fullClassName, string|null $methodName, bool $addTypeAndDefaultValue)

Builds the PHP code for the parameters of the specified method to be used in a method interceptor in the proxy class

string
buildCallParentMethodCode(string $fullClassName, string $methodName)

Build code which calls the parent method, if any.

string
buildAttributesCode(ReflectionMethod $reflectionMethod)

Build the code for the attributes of a given \ReflectionMethod object.

__construct($name = null, array $parameters = [], $flags = self::FLAG_PUBLIC, $body = null, $docBlock = null)

No description

static never
copyMethodSignature(MethodReflection $reflectionMethod)

No description

string|null
getOriginalVisibility()

No description

string

Details

static ProxyMethodGenerator fromReflection(MethodReflection $reflectionMethod)

No description

Parameters

MethodReflection $reflectionMethod

Return Value

ProxyMethodGenerator

static ProxyMethodGenerator copyMethodSignatureAndDocblock(MethodReflection $reflectionMethod)

No description

Parameters

MethodReflection $reflectionMethod

Return Value

ProxyMethodGenerator

string|null getFullOriginalClassName()

No description

Return Value

string|null

void setFullOriginalClassName(string $fullOriginalClassName)

No description

Parameters

string $fullOriginalClassName

Return Value

void

void addPreParentCallCode(string $code)

Adds PHP code to the body of this proxy method which will be executed before a possible parent call.

Parameters

string $code

Return Value

void

void addPostParentCallCode(string $code)

Adds PHP code to the body of this proxy method which will be executed after a possible parent call.

Parameters

string $code

Return Value

void

string generate()

Generates the code for the method.

This method overrides the parent generate() method in order to insert attributes code. As soon as https://github.com/laminas/laminas-code/pull/145 is merged and released, this can be implemented properly.

Return Value

string

The generated method code.

string renderBodyCode()

No description

Return Value

string

bool willBeRendered()

Tells if enough code was provided (yet) so that this method would actually be rendered if render() is called.

Return Value

bool

true if there is any code to render, otherwise false

string buildMethodParametersCode(string|null $fullClassName, string|null $methodName, bool $addTypeAndDefaultValue)

Builds the PHP code for the parameters of the specified method to be used in a method interceptor in the proxy class

Parameters

string|null $fullClassName

Name of the class the method is declared in

string|null $methodName

Name of the method to create the parameters code for

bool $addTypeAndDefaultValue

If the type and default value for each parameter should be rendered

Return Value

string

A comma separated list of parameters

protected string buildCallParentMethodCode(string $fullClassName, string $methodName)

Build code which calls the parent method, if any.

Note that $fullClassName is the original, non-proxied class and $parentClassName is the name of a potential non-proxied parent class of the original class.

The context where the parent:: call is made is a proxy class. Therefore, the call will

  • either call the method in the original class of the current proxy, if it exists, or
  • call the original method in the parent class or
  • call the proxied method in the parent class or
  • call the original method in a subclass or
  • call the proxied method in a subclass

See the ProxyCompilerTest functional tests for examples of these cases.

Parameters

string $fullClassName

Fully qualified name of the original class

string $methodName

Name of the original method

Return Value

string

PHP code

protected string buildAttributesCode(ReflectionMethod $reflectionMethod)

Build the code for the attributes of a given \ReflectionMethod object.

Note: This is just a preliminary solution until https://github.com/laminas/laminas-code/pull/145 is implemented and released.

Parameters

ReflectionMethod $reflectionMethod

The \ReflectionMethod object to retrieve attributes from.

Return Value

string

The code for the attributes of the given \ReflectionMethod object.

Exceptions

UnsupportedAttributeException

__construct($name = null, array $parameters = [], $flags = self::FLAG_PUBLIC, $body = null, $docBlock = null)

No description

Parameters

$name
array $parameters
$flags
$body
$docBlock

static never copyMethodSignature(MethodReflection $reflectionMethod)

No description

Parameters

MethodReflection $reflectionMethod

Return Value

never

Exceptions

BadMethodCallException

string|null getOriginalVisibility()

No description

Return Value

string|null

protected string buildAssignMethodArgumentsCode()

No description

Return Value

string