Zend\Mvc\Service\AbstractPluginManagerFactory::__invoke PHP Method

__invoke() public method

Classes that extend this should provide a valid class for the PLUGIN_MANGER_CLASS constant.
public __invoke ( Interop\Container\ContainerInterface $container, string $name, array $options = null ) : Zend\ServiceManager\AbstractPluginManager
$container Interop\Container\ContainerInterface
$name string
$options array
return Zend\ServiceManager\AbstractPluginManager
    public function __invoke(ContainerInterface $container, $name, array $options = null)
    {
        $options = $options ?: [];
        $pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
        return new $pluginManagerClass($container, $options);
    }

Usage Example

 /**
  * Create and return the view helper manager
  *
  * @param  ContainerInterface $container
  * @return HelperPluginManager
  * @throws ServiceNotCreatedException
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $options = $options ?: [];
     $options['factories'] = isset($options['factories']) ? $options['factories'] : [];
     $plugins = parent::__invoke($container, $requestedName, $options);
     // Override plugin factories
     $plugins = $this->injectOverrideFactories($plugins, $container);
     return $plugins;
 }
AbstractPluginManagerFactory