CachedDoubler
extends Doubler
in package
Cached class doubler.
Prevents mirroring/creation of the same structure twice.
Tags
Table of Contents
- $classes : mixed
- $creator : mixed
- $instantiator : Instantiator
- $mirror : mixed
- $namer : mixed
- $patches : array<string|int, ClassPatchInterface>
- __construct() : mixed
- Initializes doubler.
- double() : DoubleInterface
- Creates double from specific class or/and list of interfaces.
- getClassPatches() : array<string|int, ClassPatchInterface>
- Returns list of registered class patches.
- registerClassPatch() : mixed
- Registers new class patch.
- resetCache() : mixed
- createDoubleClass() : string
- Creates double class and returns its FQN.
- generateClassId() : string
Properties
$classes
private
static mixed
$classes
= array()
$creator
private
mixed
$creator
$instantiator
private
Instantiator
$instantiator
$mirror
private
mixed
$mirror
$namer
private
mixed
$namer
$patches
private
array<string|int, ClassPatchInterface>
$patches
= array()
Methods
__construct()
Initializes doubler.
public
__construct([ClassMirror $mirror = null ][, ClassCreator $creator = null ][, NameGenerator $namer = null ]) : mixed
Parameters
- $mirror : ClassMirror = null
- $creator : ClassCreator = null
- $namer : NameGenerator = null
Return values
mixed —double()
Creates double from specific class or/and list of interfaces.
public
double([ReflectionClass $class = null ], array<string|int, ReflectionClass> $interfaces[, array<string|int, mixed> $args = null ]) : DoubleInterface
Parameters
- $class : ReflectionClass = null
- $interfaces : array<string|int, ReflectionClass>
-
Array of ReflectionClass instances
- $args : array<string|int, mixed> = null
-
Constructor arguments
Tags
Return values
DoubleInterface —getClassPatches()
Returns list of registered class patches.
public
getClassPatches() : array<string|int, ClassPatchInterface>
Return values
array<string|int, ClassPatchInterface> —registerClassPatch()
Registers new class patch.
public
registerClassPatch(ClassPatchInterface $patch) : mixed
Parameters
- $patch : ClassPatchInterface
Return values
mixed —resetCache()
public
resetCache() : mixed
Return values
mixed —createDoubleClass()
Creates double class and returns its FQN.
protected
createDoubleClass([ReflectionClass $class = null ], array<string|int, mixed> $interfaces) : string
Parameters
- $class : ReflectionClass = null
- $interfaces : array<string|int, mixed>
Return values
string —generateClassId()
private
generateClassId([ReflectionClass $class = null ], array<string|int, ReflectionClass> $interfaces) : string
Parameters
- $class : ReflectionClass = null
- $interfaces : array<string|int, ReflectionClass>