Plugin manager implementation for input filters.
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.
Methods
Constructor
__construct(\Zend\ServiceManager\ConfigInterface $configuration)
Add a default initializer to ensure the plugin is valid after instance
creation.
Parameters
Sets the given service name as to be handled by a delegator factory
addDelegator(string $serviceName, string $delegatorFactoryName) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::addDelegator() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::addDelegator() |
Parameters
$serviceName
string
name of the service being the delegate
$delegatorFactoryName
string
name of the service being the delegator factory
Returns
Add a peering relationship
addPeeringServiceManager(\Zend\ServiceManager\ServiceManager $manager, string $peering) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::addPeeringServiceManager() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::addPeeringServiceManager() |
Parameters
$peering
string
Returns
Determine if we can create an instance.
canCreate(string | array $name, bool $checkAbstractFactories) : bool
Inherited
Proxies to has()
inherited_from |
\Zend\ServiceManager\ServiceManager::canCreate() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::canCreate() |
Parameters
$name
stringarray
$checkAbstractFactories
bool
Returns
bool
Determine if we can create an instance from an abstract factory.
canCreateFromAbstractFactory(string $cName, string $rName) : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::canCreateFromAbstractFactory() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::canCreateFromAbstractFactory() |
Parameters
$cName
string
$rName
string
Returns
bool
Create an instance of the requested service
create(string | array $name) : bool | object
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::create() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::create() |
Parameters
$name
stringarray
Returns
bool
object
Create scoped service manager
createScopedServiceManager(string $peering) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::createScopedServiceManager() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::createScopedServiceManager() |
Parameters
$peering
string
Returns
Retrieve a service from the manager by name
get(string $name, array $options, bool $usePeeringServiceManagers) : object
Inherited
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.
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::get() |
Parameters
$name
string
$options
array
$usePeeringServiceManagers
bool
Exceptions
Returns
object
Get allow override
getAllowOverride() : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::getAllowOverride() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::getAllowOverride() |
Returns
bool
Retrieve a keyed list of all canonical names.
getCanonicalNames() : array
Inherited
Handy for debugging!
inherited_from |
\Zend\ServiceManager\ServiceManager::getCanonicalNames() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::getCanonicalNames() |
Returns
array
Retrieve a keyed list of all registered services.
getRegisteredServices() : array
Inherited
Handy for debugging!
inherited_from |
\Zend\ServiceManager\ServiceManager::getRegisteredServices() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::getRegisteredServices() |
Returns
array
Get the main plugin manager.
getServiceLocator() : \Zend\ServiceManager\ServiceLocatorInterface
Inherited
Useful for fetching dependencies from within factories.
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::getServiceLocator() |
Returns
Get throw exceptions in create
getThrowExceptionInCreate() : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::getThrowExceptionInCreate() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::getThrowExceptionInCreate() |
Returns
bool
Determine if an instance exists.
has(string | array $name, bool $checkAbstractFactories, bool $usePeeringServiceManagers) : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::has() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::has() |
Parameters
$name
stringarray
An array argument accepts exactly two values. Example: array('canonicalName', 'requestName')
$checkAbstractFactories
bool
$usePeeringServiceManagers
bool
Returns
bool
Determine if we have an alias
hasAlias(string $alias) : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::hasAlias() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::hasAlias() |
Parameters
$alias
string
Returns
bool
isShared()
isShared(string $name) : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::isShared() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::isShared() |
Parameters
$name
string
Exceptions
Returns
bool
Inject this and populate the factory with filter chain and validator chain
populateFactory($inputFilter)
Should we retrieve from the peering manager prior to attempting to create a service?
retrieveFromPeeringManagerFirst() : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::retrieveFromPeeringManagerFirst() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::retrieveFromPeeringManagerFirst() |
Returns
bool
setAlias()
setAlias(string $alias, string $nameOrAlias) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setAlias() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setAlias() |
Parameters
$alias
string
$nameOrAlias
string
Exceptions
Returns
Set allow override
setAllowOverride($allowOverride) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setAllowOverride() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setAllowOverride() |
Parameters
$allowOverride
Returns
Allows to override the canonical names lookup map with predefined
values.
setCanonicalNames(array $canonicalNames) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setCanonicalNames() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setCanonicalNames() |
Parameters
$canonicalNames
array
Returns
Set factory
setFactory(string $name, string | \Zend\ServiceManager\FactoryInterface | \Zend\ServiceManager\callable $factory, bool $shared) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setFactory() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setFactory() |
Parameters
$name
string
$shared
bool
Exceptions
Returns
Set invokable class
setInvokableClass(string $name, string $invokableClass, bool $shared) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setInvokableClass() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setInvokableClass() |
Parameters
$name
string
$invokableClass
string
$shared
bool
Exceptions
Returns
Set flag indicating whether to pull from peering manager before attempting creation
setRetrieveFromPeeringManagerFirst(bool $retrieveFromPeeringManagerFirst) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setRetrieveFromPeeringManagerFirst() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setRetrieveFromPeeringManagerFirst() |
Parameters
$retrieveFromPeeringManagerFirst
bool
Returns
Register a service with the locator.
setService(string $name, mixed $service, bool $shared) : \Zend\ServiceManager\AbstractPluginManager
Inherited
Validates that the service object via validatePlugin() prior to
attempting to register it.
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setService() |
Parameters
$name
string
$service
mixed
$shared
bool
Exceptions
Returns
Set the main service locator so factories can have access to it to pull deps
setServiceLocator(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) : \Zend\ServiceManager\AbstractPluginManager
Inherited
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setServiceLocator() |
Parameters
Returns
Set flag indicating whether services are shared by default
setShareByDefault(bool $shareByDefault) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setShareByDefault() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setShareByDefault() |
Parameters
$shareByDefault
bool
Exceptions
Returns
setShared()
setShared(string $name, bool $isShared) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setShared() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setShared() |
Parameters
$name
string
$isShared
bool
Exceptions
Returns
Set throw exceptions in create
setThrowExceptionInCreate(bool $throwExceptionInCreate) : \Zend\ServiceManager\ServiceManager
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::setThrowExceptionInCreate() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::setThrowExceptionInCreate() |
Parameters
$throwExceptionInCreate
bool
Returns
Are services shared by default?
shareByDefault() : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::shareByDefault() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::shareByDefault() |
Returns
bool
Validate the plugin
validatePlugin(mixed $plugin) : void
Checks that the filter loaded is either a valid callback or an instance
of FilterInterface.
Parameters
$plugin
mixed
Exceptions
Canonicalize name
canonicalizeName(string $name) : string
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::canonicalizeName() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::canonicalizeName() |
Parameters
$name
string
Returns
string
Ensure the alias definition will not result in a circular reference
checkForCircularAliasReference(string $alias, string $nameOrAlias) : \Zend\ServiceManager\self
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::checkForCircularAliasReference() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::checkForCircularAliasReference() |
Parameters
$alias
string
$nameOrAlias
string
Exceptions
Returns
\Zend\ServiceManager\self
checkNestedContextStart()
checkNestedContextStart(string $cName) : \Zend\ServiceManager\self
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::checkNestedContextStart() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::checkNestedContextStart() |
Parameters
$cName
string
Returns
\Zend\ServiceManager\self
checkNestedContextStop()
checkNestedContextStop(bool $force) : \Zend\ServiceManager\self
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::checkNestedContextStop() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::checkNestedContextStop() |
Parameters
$force
bool
Returns
\Zend\ServiceManager\self
createDelegatorFromFactory()
createDelegatorFromFactory($canonicalName, $requestedName) : mixed
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::createDelegatorFromFactory() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::createDelegatorFromFactory() |
Parameters
$canonicalName
$requestedName
Exceptions
Returns
mixed
Attempt to create an instance via an abstract factory
createFromAbstractFactory(string $canonicalName, string $requestedName) : object | null
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::createFromAbstractFactory() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::createFromAbstractFactory() |
Parameters
$canonicalName
string
$requestedName
string
Exceptions
Returns
object
null
Attempt to create an instance via a factory class
createFromFactory(string $canonicalName, string $requestedName) : mixed
Inherited
Overrides parent implementation by passing $creationOptions to the
constructor, if non-null.
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::createFromFactory() |
Parameters
$canonicalName
string
$requestedName
string
Exceptions
Returns
mixed
Attempt to create an instance via an invokable class
createFromInvokable(string $canonicalName, string $requestedName) : null | \stdClass
Inherited
Overrides parent implementation by passing $creationOptions to the
constructor, if non-null.
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::createFromInvokable() |
Parameters
$canonicalName
string
$requestedName
string
Exceptions
Returns
Create service via callback
createServiceViaCallback(\Zend\ServiceManager\callable $callable, string $cName, string $rName) : object
Inherited
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::createServiceViaCallback() |
Parameters
$callable
\Zend\ServiceManager\callable
$cName
string
$rName
string
Exceptions
Returns
object
Checks if the object has this class as one of its parents
isSubclassOf(string $className, string $type) : bool
Inherited
see |
\Zend\ServiceManager\https://bugs.php.net/bug.php?id=53727 |
see |
\Zend\ServiceManager\https://github.com/zendframework/zf2/pull/1807 |
inherited_from |
\Zend\ServiceManager\ServiceManager::isSubclassOf() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::isSubclassOf() |
Parameters
$className
string
$type
string
Returns
bool
Loop over peering service managers.
loopPeeringServiceManagers(string $name) : mixed
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::loopPeeringServiceManagers() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::loopPeeringServiceManagers() |
Parameters
$name
string
Returns
mixed
Resolve the alias for the given canonical name
resolveAlias(string $cName) : string
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::resolveAlias() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::resolveAlias() |
Parameters
$cName
string
The canonical name to resolve
Returns
string
The resolved canonical name
Attempt to retrieve an instance via a peering manager
retrieveFromPeeringManager(string $name) : mixed
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::retrieveFromPeeringManager() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::retrieveFromPeeringManager() |
Parameters
$name
string
Returns
mixed
Unregister a service
unregisterService(string $canonical) : void
Inherited
Called when $allowOverride is true and we detect that a service being
added to the instance already exists. This will remove the duplicate
entry, and also any shared flags previously registered.
inherited_from |
\Zend\ServiceManager\ServiceManager::unregisterService() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::unregisterService() |
Parameters
$canonical
string
Creates a callback that uses a delegator to create a service
createDelegatorCallback(\Zend\ServiceManager\DelegatorFactoryInterface | \Zend\ServiceManager\callable $delegatorFactory, string $rName, string $cName, \Zend\ServiceManager\callable $creationCallback) : \Zend\ServiceManager\callable
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::createDelegatorCallback() |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::createDelegatorCallback() |
Parameters
$rName
string
requested service name
$cName
string
canonical service name
$creationCallback
\Zend\ServiceManager\callable
callback for instantiating the real service
Returns
\Zend\ServiceManager\callable
tryThrowingServiceLocatorUsageException()
tryThrowingServiceLocatorUsageException(string $serviceName, bool $isAutoInvokable, \Exception $exception)
Inherited
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::tryThrowingServiceLocatorUsageException() |
Parameters
$serviceName
string
$isAutoInvokable
bool
Exceptions
Properties
$abstractFactories
$abstractFactories : \Zend\ServiceManager\AbstractFactoryInterface[]
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$abstractFactories |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$abstractFactories |
$aliases
$aliases : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$aliases |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$aliases |
Allow overriding by default
$allowOverride : bool
Inherited
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$allowOverride |
Whether or not to auto-add a class as an invokable class if it exists
$autoAddInvokableClass : bool
Inherited
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$autoAddInvokableClass |
Lookup for canonicalized names.
$canonicalNames : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$canonicalNames |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$canonicalNames |
<p>map of characters to be replaced through strtr</p>
$canonicalNamesReplacements : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$canonicalNamesReplacements |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$canonicalNamesReplacements |
Options to use when creating an instance
$creationOptions : mixed
Inherited
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$creationOptions |
$delegators
$delegators : array[]
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$delegators |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$delegators |
$factories
$factories : string | \Zend\ServiceManager\callable | \Closure | \Zend\ServiceManager\FactoryInterface[]
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$factories |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$factories |
$initializers
$initializers : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$initializers |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$initializers |
Registered services and cached values
$instances : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$instances |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$instances |
Default set of plugins
$invokableClasses : array
$nestedContext
$nestedContext : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$nestedContext |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$nestedContext |
$nestedContextCounter
$nestedContextCounter : integer
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$nestedContextCounter |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$nestedContextCounter |
$peeringServiceManagers
$peeringServiceManagers : \Zend\ServiceManager\ServiceManager[]
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$peeringServiceManagers |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$peeringServiceManagers |
$pendingAbstractFactoryRequests
$pendingAbstractFactoryRequests : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$pendingAbstractFactoryRequests |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$pendingAbstractFactoryRequests |
$retrieveFromPeeringManagerFirst
$retrieveFromPeeringManagerFirst : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$retrieveFromPeeringManagerFirst |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$retrieveFromPeeringManagerFirst |
$serviceManagerCaller
$serviceManagerCaller : \Zend\ServiceManager\ServiceLocatorInterface
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$serviceManagerCaller |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$serviceManagerCaller |
Whether or not to share by default
$shareByDefault : bool
$shared
$shared : array
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$shared |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$shared |
<p>Track whether not to throw exceptions during create()</p>
$throwExceptionInCreate : bool
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::$$throwExceptionInCreate |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::$$throwExceptionInCreate |
Constants
SCOPE_CHILD
SCOPE_CHILD
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::SCOPE_CHILD |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::SCOPE_CHILD |
SCOPE_PARENT
SCOPE_PARENT
Inherited
inherited_from |
\Zend\ServiceManager\ServiceManager::SCOPE_PARENT |
inherited_from |
\Zend\ServiceManager\AbstractPluginManager::SCOPE_PARENT |