ServiceManager implementation for managing plugins
Automatically registers an initializer which should be used to verify that a plugin instance is of a valid type. Additionally, allows plugins to accept an array of options for the constructor, which can be used to configure the plugin when retrieved. Finally, enables the allowOverride property by default to allow registering factories, aliases, and invokables to take the place of those provided by the implementing class.
Constructor
Add a default initializer to ensure the plugin is valid after instance creation.
Parameters: | null|ConfigInterface – |
---|
Validate the plugin
Checks that the filter loaded is either a valid callback or an instance of FilterInterface.
Parameters: | mixed – |
---|---|
Return type: | void |
Throws : | ExceptionRuntimeException if invalid |
Retrieve a service from the manager by name
Allows passing an array of options to use when creating the instance. createFromInvokable() will use these and pass them to the instance constructor if not null and a non-empty array.
Parameters: |
|
---|---|
Return type: | object |
Register a service with the locator.
Validates that the service object via validatePlugin() prior to attempting to register it.
Parameters: |
|
---|---|
Return type: | AbstractPluginManager |
Throws : | ExceptionInvalidServiceNameException |
Set the main service locator so factories can have access to it to pull deps
Parameters: | ServiceLocatorInterface – |
---|---|
Return type: | AbstractPluginManager |
Get the main plugin manager. Useful for fetching dependencies from within factories.
Return type: | mixed |
---|
Attempt to create an instance via an invokable class
Overrides parent implementation by passing $creationOptions to the constructor, if non-null.
Parameters: |
|
---|---|
Return type: | null|stdClass |
Throws : | ExceptionServiceNotCreatedException If resolved class does not exist |
Attempt to create an instance via a factory class
Overrides parent implementation by passing $creationOptions to the constructor, if non-null.
Parameters: |
|
---|---|
Return type: | mixed |
Throws : | ExceptionServiceNotCreatedException If factory is not callable |