Factory Interface Reference

Detailed Description

Interface for Factory implementations.

A Factory is used to instantiate services to be used by clients.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 19 of file Factory.php.

+ Inheritance diagram for Factory:

Public Member Functions

 getInstance ($name, $dynamicConfiguration=[])
 
 getNewInstance ($name, $dynamicConfiguration=[])
 
 getInstanceOf ($class, $dynamicConfiguration=[])
 
 registerInstance ($name, $instance)
 
 addInterfaces (array $interfaces)
 
 clear ()
 

Member Function Documentation

◆ getInstance()

getInstance (   $name,
  $dynamicConfiguration = [] 
)

Get an instance from the configuration.

Instances created with this method might be shared (depending on the __shared configuration property).

Note
Instance names are treated case insensitive
Parameters
$nameThe name of the instance (section, where the instance is defined)
$dynamicConfigurationAssociative array with key value pairs for dynamic instance properties (optional)
Returns
Object

Implemented in DefaultFactory.

◆ getNewInstance()

getNewInstance (   $name,
  $dynamicConfiguration = [] 
)

Get a new instance from the configuration.

Instances created with this method are not shared.

Note
Instance names are treated case insensitive
Parameters
$nameThe name of the instance (section, where the instance is defined)
$dynamicConfigurationAssociative array with key value pairs for dynamic instance properties (optional)
Returns
Object

Implemented in DefaultFactory.

◆ getInstanceOf()

getInstanceOf (   $class,
  $dynamicConfiguration = [] 
)

Create an instance of a class.

Instances created with this method are not shared.

Parameters
$classThe name of the class
$dynamicConfigurationAssociative array with key value pairs for dynamic instance properties (optional)
Returns
Object

Implemented in DefaultFactory.

◆ registerInstance()

registerInstance (   $name,
  $instance 
)

Register a shared instance with a given name.

Note
Instance names are treated case insensitive
Parameters
$nameThe name of the instance.
$instanceThe instance

Implemented in DefaultFactory.

◆ addInterfaces()

addInterfaces ( array  $interfaces)

Add interfaces that instances must implement.

Parameters
$interfacesAssociative array with instance names as keys and interface names as values.

Implemented in DefaultFactory.

◆ clear()

clear ( )

Delete all created instances.

Implemented in DefaultFactory.