class DependencyProxy (View source)

A Proxy Class Builder which integrates Dependency Injection.

Properties

protected string $className
protected Closure $builder
protected array $propertyVariables

Methods

__construct(string $className, Closure $builder)

Constructs this proxy

object
_activateDependency()

Activate the dependency and set it in the object.

string
_getClassName()

Returns the class name of the proxied dependency

void
_addPropertyVariable(mixed $propertyVariable)

Adds another variable by reference where the actual dependency object should be injected into once this proxy is activated.

mixed
__call(string $methodName, array $arguments)

Proxy magic call method which triggers the injection of the real dependency and returns the result of a call to the original method in the dependency

Details

__construct(string $className, Closure $builder)

Constructs this proxy

Parameters

string $className

Implementation class name of the dependency to proxy

Closure $builder

The closure which eventually builds the dependency

object _activateDependency()

Activate the dependency and set it in the object.

Return Value

object

The real dependency object

string _getClassName()

Returns the class name of the proxied dependency

Return Value

string

Fully qualified class name of the proxied object

void _addPropertyVariable(mixed $propertyVariable)

Adds another variable by reference where the actual dependency object should be injected into once this proxy is activated.

Parameters

mixed $propertyVariable

The variable to replace

Return Value

void

mixed __call(string $methodName, array $arguments)

Proxy magic call method which triggers the injection of the real dependency and returns the result of a call to the original method in the dependency

Parameters

string $methodName

Name of the method to be called

array $arguments

An array of arguments to be passed to the method

Return Value

mixed