LazyLoadingGhostFactory
extends AbstractBaseFactory
in package
Factory responsible of producing ghost instances
Table of Contents
Properties
- $configuration : mixed
- $checkedClasses : array<string, string>
- Cached checked class names
- $generator : mixed
Methods
- __construct() : mixed
- createProxy() : GhostObjectInterface
- Creates a new lazy proxy instance of the given class with the given initializer
- generateProxy() : string
- Generate a proxy from a class name
- getGenerator() : ProxyGeneratorInterface
- generateProxyClass() : void
- Generates the provided `$proxyClassName` from the given `$className` and `$proxyParameters`
Properties
$configuration
protected
mixed
$configuration
$checkedClasses
Cached checked class names
private
array<string, string>
$checkedClasses
= []
Tags
$generator
private
mixed
$generator
Methods
__construct()
public
__construct([Configuration|null $configuration = null ]) : mixed
Parameters
- $configuration : Configuration|null = null
createProxy()
Creates a new lazy proxy instance of the given class with the given initializer
public
createProxy(string $className, Closure $initializer[, array<string|int, mixed> $proxyOptions = [] ]) : GhostObjectInterface
Please refer to the following documentation when using this method:
Parameters
- $className : string
-
name of the class to be proxied
- $initializer : Closure
-
initializer to be passed to the proxy. The initializer closure should have following signature:
$initializer = function ( GhostObjectInterface $proxy, string $method, array $parameters, & $initializer, array $properties ) };
Where:
- $proxy is the proxy instance on which the initializer is acting
- $method is the name of the method that triggered the lazy initialization
- $parameters are the parameters that were passed to $method
- $initializer by-ref initializer - should be assigned null in the initializer body
- $properties a by-ref map of the properties of the object, indexed by PHP internal property name. Assign values to it to initialize the object state
- $proxyOptions : array<string|int, mixed> = []
-
a set of options to be used when generating the proxy. Currently supports only key "skippedProperties", which allows to skip lazy-loading of some properties. "skippedProperties" is a string[], containing a list of properties referenced via PHP's internal property name (i.e. "\0ClassName\0propertyName")
Tags
Return values
GhostObjectInterfacegenerateProxy()
Generate a proxy from a class name
protected
generateProxy(string $className[, array<string, mixed> $proxyOptions = [] ]) : string
Parameters
- $className : string
- $proxyOptions : array<string, mixed> = []
Tags
Return values
stringgetGenerator()
protected
getGenerator() : ProxyGeneratorInterface
Return values
ProxyGeneratorInterfacegenerateProxyClass()
Generates the provided `$proxyClassName` from the given `$className` and `$proxyParameters`
private
generateProxyClass(string $proxyClassName, string $className, array<string, mixed> $proxyParameters[, array<string, mixed> $proxyOptions = [] ]) : void
Parameters
- $proxyClassName : string
- $className : string
- $proxyParameters : array<string, mixed>
- $proxyOptions : array<string, mixed> = []