StaticCrossCuttingLoader
in package
Class StaticCrossCuttingLoader
This class wraps the CrossCuttingLoader for static use.
CrossCuttingLoader enables loading of mockable objects for cross cutting concerns, that were not injected to the current object.
Tags
Table of Contents
- $crossCuttingLoader : CrossCuttingLoaderInterface
- __construct() : mixed
- clearRegister() : void
- getObject() : object
- In strict mode ($crossCuttingLoader->strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.
- registerObject() : mixed
- In strict mode ($crossCuttingLoader->strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.
- setRegisteredObjectsOnly() : mixed
- If RegisteredObjectsOnly is enabled, the loader returns only objects, that were registered by the registerObject method before. RegisteredObjectsOnly should be enabled in all unit tests.
- useRegisteredObjectsOnly() : bool
- _getCrossCuttingLoader() : CrossCuttingLoaderInterface
Properties
$crossCuttingLoader
protected
static CrossCuttingLoaderInterface
$crossCuttingLoader
=
ull
Methods
__construct()
public
__construct() : mixed
Tags
Return values
mixed —clearRegister()
public
static clearRegister() : void
Return values
void —getObject()
In strict mode ($crossCuttingLoader->strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.
public
static getObject(string $p_classname) : object
Parameters
- $p_classname : string
Tags
Return values
object —registerObject()
In strict mode ($crossCuttingLoader->strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.
public
static registerObject(string $p_classname, object $object) : mixed
Parameters
- $p_classname : string
- $object : object
Tags
Return values
mixed —setRegisteredObjectsOnly()
If RegisteredObjectsOnly is enabled, the loader returns only objects, that were registered by the registerObject method before. RegisteredObjectsOnly should be enabled in all unit tests.
public
static setRegisteredObjectsOnly( $bool_status) : mixed
Parameters
Return values
mixed —useRegisteredObjectsOnly()
public
static useRegisteredObjectsOnly() : bool
Return values
bool —_getCrossCuttingLoader()
protected
static _getCrossCuttingLoader() : CrossCuttingLoaderInterface