Documentation

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

$checkedClasses

Cached checked class names

private array<string, string> $checkedClasses = []
Tags
psalm-var

array<string, class-string>

Methods

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
link
https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-ghost-object.md
psalm-param

class-string<RealObjectType> $className

psalm-param

Closure( RealObjectType&GhostObjectInterface<RealObjectType>=, string=, array<string, mixed>=, ?Closure=, array<string, mixed>= ) : bool $initializer

psalm-param

array{skippedProperties?: array<int, string>} $proxyOptions

psalm-return

RealObjectType&GhostObjectInterface<RealObjectType>

throws
MissingSignatureException
throws
InvalidSignatureException
throws
OutOfBoundsException
psalm-template

RealObjectType as object

psalm-suppress

MixedInferredReturnType We ignore type checks here, since staticProxyConstructor is not interfaced (by design)

Return values
GhostObjectInterface

generateProxy()

Generate a proxy from a class name

protected generateProxy(string $className[, array<string, mixed> $proxyOptions = [] ]) : string
Parameters
$className : string
$proxyOptions : array<string, mixed> = []
Tags
psalm-param

class-string<RealObjectType> $className

psalm-return

class-string<RealObjectType>

throws
InvalidSignatureException
throws
MissingSignatureException
throws
OutOfBoundsException
psalm-template

RealObjectType of object

Return values
string

generateProxyClass()

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> = []
Tags
psalm-param

class-string $proxyClassName

psalm-param

class-string $className


        
On this page

Search results