PHP Class Zend\Mvc\Service\ServiceListenerFactory

Inheritance: implements Zend\ServiceManager\FactoryInterface
Show file Open project: zendframework/zend-mvc

Protected Properties

Property Type Description
$defaultServiceConfig array Default mvc-related service configuration -- can be overridden by modules.

Public Methods

Method Description
__construct ( ) Constructor
__invoke ( Interop\Container\ContainerInterface $container, $requestedName, array $options = null ) : Zend\ModuleManager\Listener\ServiceListenerInterface Create the service listener service
createService ( Zend\ServiceManager\ServiceLocatorInterface $container ) : Zend\ModuleManager\Listener\ServiceListenerInterface Create and return the ServiceListener (v2)

Private Methods

Method Description
injectServiceListenerOptions ( array $options, Zend\ModuleManager\Listener\ServiceListenerInterface $serviceListener ) Validate and inject plugin manager options into the service listener.
injectV3Aliases ( ) : void Inject additional aliases for zend-servicemanager v3 usage
validatePluginManagerOptions ( array $options, string $name ) Validate the structure and types for plugin manager configuration options.

Method Details

__construct() public method

When executed under zend-servicemanager v3, injects additional aliases to ensure backwards compatibility.
public __construct ( )

__invoke() public method

Tries to get a service named ServiceListenerInterface from the service locator, otherwise creates a ServiceListener instance, passing it the container instance and the default service configuration, which can be overridden by modules. It looks for the 'service_listener_options' key in the application config and tries to add service/plugin managers as configured. The value of 'service_listener_options' must be a list (array) which contains the following keys: - service_manager: the name of the service manage to create as string - config_key: the name of the configuration key to search for as string - interface: the name of the interface that modules can implement as string - method: the name of the method that modules have to implement as string
public __invoke ( Interop\Container\ContainerInterface $container, $requestedName, array $options = null ) : Zend\ModuleManager\Listener\ServiceListenerInterface
$container Interop\Container\ContainerInterface
$options array
return Zend\ModuleManager\Listener\ServiceListenerInterface

createService() public method

Create and return the ServiceListener (v2)
public createService ( Zend\ServiceManager\ServiceLocatorInterface $container ) : Zend\ModuleManager\Listener\ServiceListenerInterface
$container Zend\ServiceManager\ServiceLocatorInterface
return Zend\ModuleManager\Listener\ServiceListenerInterface

Property Details

$defaultServiceConfig protected property

Default mvc-related service configuration -- can be overridden by modules.
protected array $defaultServiceConfig
return array