CrossCuttingLoader

Implements \CrossCuttingLoaderInterface

Class CrossCuttingLoader

CrossCuttingLoader enables loading of mockable objects for cross cutting concerns, that were not injected to the current object.

Important: RegisteredObjectsOnly flag must be enabled for unit testing.

category

System

package

Loaders

subpackage

CrossCuttingLoader

Methods

_getObjectFromMainFactory

_getObjectFromMainFactory(string $p_classname) : object

Arguments

$p_classname

string

Response

object

_getObjectFromRegister

_getObjectFromRegister(string $p_classname) : object

Arguments

$p_classname

string

Response

object

_strictModeValidateTypeOf

_strictModeValidateTypeOf( $object) 
Throws
\InvalidArgumentException

Arguments

$object

clearRegister

clearRegister() : void

In strict mode ($strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.

getObject(string $p_classname) : object
Throws
\InvalidArgumentException

Arguments

$p_classname

string

Response

object

In strict mode ($strictModeEnabled=true) this method accepts classes with implemented CrossCuttingObjectInterface only. Otherwise it throws an InvalidArgumentException.

registerObject(string $p_classname, object $object) 
Throws
\InvalidArgumentException

Arguments

$p_classname

string

$object

object

RegisteredObjectsOnly Flag Setter

setRegisteredObjectsOnly(boolean $bool_status) 

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.

Arguments

$bool_status

boolean

RegisteredObjectsOnly Flag Getter

useRegisteredObjectsOnly() : boolean

Response

boolean

Properties

strictModeEnabled

strictModeEnabled : boolean
var
todo

Move to CrossCuttingLoaderSettings

Type(s)

boolean

registeredObjectsOnly

registeredObjectsOnly : boolean
var

Type(s)

boolean

registeredObjectArrays

registeredObjectArrays : array
var

Type(s)

array