Detailed Description
Interface for Factory implementations.
A Factory is used to instantiate services to be used by clients.
Definition at line 19 of file Factory.php.
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
-
$name The name of the instance (section, where the instance is defined) $dynamicConfiguration Associative 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
-
$name The name of the instance (section, where the instance is defined) $dynamicConfiguration Associative 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
-
$class The name of the class $dynamicConfiguration Associative 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
-
$name The name of the instance. $instance The instance
Implemented in DefaultFactory.
◆ addInterfaces()
addInterfaces | ( | array | $interfaces | ) |
Add interfaces that instances must implement.
- Parameters
-
$interfaces Associative array with instance names as keys and interface names as values.
Implemented in DefaultFactory.
◆ clear()
clear | ( | ) |
Delete all created instances.
Implemented in DefaultFactory.