PHP Class Go\Proxy\ClassProxy

Inheritance: extends AbstractProxy
Datei anzeigen Open project: goaop/framework Class Usage Examples

Protected Properties

Property Type Description
$class null | ReflectionClas\ReflectionClass Parent class reflection
$interfaces array List of additional interfaces to implement
$invocationClassMap null | array .else check
$methodsCode Source code for methods
$name string Name for the current class
$parentClassName string Parent class name, can be changed manually
$propertiesCode Source code for properties
$traits array List of additional traits for using

Public Methods

Method Description
__construct ( ReflectionClass $parent, array $classAdvices ) Generates an child code by parent class reflection and joinpoints for it
__toString ( ) {@inheritDoc}
addInterface ( string | ReflectionClas\ReflectionClass $interface ) Add an interface for child
addTrait ( string | ReflectionClas\ReflectionClass $trait ) Add a trait for child
injectJoinPoints ( string $className, array $advices = [] ) : void Inject advices into given class
override ( string $methodName, string $body ) : static Override parent method with new body
setMethod ( integer $methodFlags, string $methodName, boolean $byReference, string $body, string $parameters ) : static Creates a method
setParentName ( string $newParentName ) : static Updates parent name for child
setProperty ( integer $propFlags, string $propName, null | string $defaultText = null ) : static Creates a property

Protected Methods

Method Description
addFieldInterceptorsCode ( ReflectionMethod $constructor = null ) Add code for intercepting properties
addJoinpointsProperty ( ) : void Adds a definition for joinpoints private property in the class
getJoinpointInvocationBody ( ReflectionMethod $method ) : string Creates definition for method body
interceptProperty ( ReflectionProperty $property ) Makes property intercepted
overrideMethod ( ReflectionMethod $method ) Override parent method with joinpoint invocation
wrapWithJoinPoints ( array | Go\Aop\Advice[] $classAdvices, string $className ) : array | Go\Aop\Intercept\Joinpoint[] Wrap advices with joinpoint object

Private Methods

Method Description
getConstructorBody ( ReflectionMethod $constructor = null, boolean $isCallParent = false ) : string Returns constructor code

Method Details

__construct() public method

Generates an child code by parent class reflection and joinpoints for it
public __construct ( ReflectionClass $parent, array $classAdvices )
$parent ReflectionClass Parent class reflection
$classAdvices array List of advices for class

__toString() public method

{@inheritDoc}
public __toString ( )

addFieldInterceptorsCode() protected method

Add code for intercepting properties
protected addFieldInterceptorsCode ( ReflectionMethod $constructor = null )
$constructor ReflectionMethod Constructor reflection or null

addInterface() public method

Add an interface for child
public addInterface ( string | ReflectionClas\ReflectionClass $interface )
$interface string | ReflectionClas\ReflectionClass

addJoinpointsProperty() protected method

Adds a definition for joinpoints private property in the class
protected addJoinpointsProperty ( ) : void
return void

addTrait() public method

Add a trait for child
public addTrait ( string | ReflectionClas\ReflectionClass $trait )
$trait string | ReflectionClas\ReflectionClass

getJoinpointInvocationBody() protected method

Creates definition for method body
protected getJoinpointInvocationBody ( ReflectionMethod $method ) : string
$method ReflectionMethod Method reflection
return string new method body

injectJoinPoints() public static method

NB This method will be used as a callback during source code evaluation to inject joinpoints
public static injectJoinPoints ( string $className, array $advices = [] ) : void
$className string Aop child proxy class
$advices array List of advices to inject into class
return void

interceptProperty() protected method

Makes property intercepted
protected interceptProperty ( ReflectionProperty $property )
$property ReflectionProperty Reflection of property to intercept

override() public method

Override parent method with new body
public override ( string $methodName, string $body ) : static
$methodName string Method name to override
$body string New body for method
return static

overrideMethod() protected method

Override parent method with joinpoint invocation
protected overrideMethod ( ReflectionMethod $method )
$method ReflectionMethod Method reflection

setMethod() public method

Creates a method
public setMethod ( integer $methodFlags, string $methodName, boolean $byReference, string $body, string $parameters ) : static
$methodFlags integer See ReflectionMethod modifiers
$methodName string Name of the method
$byReference boolean Is method should return value by reference
$body string Body of method
$parameters string Definition of parameters
return static

setParentName() public method

Updates parent name for child
public setParentName ( string $newParentName ) : static
$newParentName string New class name
return static

setProperty() public method

Creates a property
public setProperty ( integer $propFlags, string $propName, null | string $defaultText = null ) : static
$propFlags integer See ReflectionProperty modifiers
$propName string Name of the property
$defaultText null | string Default value, should be string text!
return static

wrapWithJoinPoints() protected static method

Wrap advices with joinpoint object
protected static wrapWithJoinPoints ( array | Go\Aop\Advice[] $classAdvices, string $className ) : array | Go\Aop\Intercept\Joinpoint[]
$classAdvices array | Go\Aop\Advice[] Advices for specific class
$className string Name of the original class to use
return array | Go\Aop\Intercept\Joinpoint[] returns list of joinpoint ready to use

Property Details

$class protected_oe property

Parent class reflection
protected null|ReflectionClass,ReflectionClas $class
return null | ReflectionClas\ReflectionClass

$interfaces protected_oe property

List of additional interfaces to implement
protected array $interfaces
return array

$invocationClassMap protected_oe static_oe property

.else check
protected static null|array $invocationClassMap
return null | array

$methodsCode protected_oe property

Source code for methods
protected $methodsCode

$name protected_oe property

Name for the current class
protected string $name
return string

$parentClassName protected_oe property

Parent class name, can be changed manually
protected string $parentClassName
return string

$propertiesCode protected_oe property

Source code for properties
protected $propertiesCode

$traits protected_oe property

List of additional traits for using
protected array $traits
return array