Zend Framework  3.0
Public Member Functions | Protected Attributes | List of all members
HelperPluginManager Class Reference

Plugin manager implementation for view helpers. More...

Public Member Functions

 __construct ($configOrContainerInstance=null, array $v3config=[])
 Constructor.
 
 setRenderer (Renderer\RendererInterface $renderer)
 Set renderer.
 
 getRenderer ()
 Retrieve renderer instance.
 
 injectRenderer ($first, $second)
 Inject a helper instance with the registered renderer.
 
 injectTranslator ($first, $second)
 Inject a helper instance with the registered translator.
 
 injectEventManager ($first, $second)
 Inject a helper instance with the registered event manager.
 
 validate ($instance)
 Validate the plugin is of the expected type (v3).
 
 validatePlugin ($instance)
 Validate the plugin is of the expected type (v2).
 
- Public Member Functions inherited from AbstractPluginManager
 __construct ($configInstanceOrParentLocator=null, array $config=[])
 Constructor.
 
 configure (array $config)
 Override configure() to validate service instances.
 
 get ($name, array $options=null)
 
 
 validate ($instance)
 Validate an instance.
Parameters
object$instance
Returns
void
Exceptions
InvalidServiceExceptionIf created instance does not respect the constraint on type imposed by the plugin manager
ContainerExceptionif any other error occurs

 
 setServiceLocator (ContainerInterface $container)
 Implemented for backwards compatibility only.
 
- Public Member Functions inherited from ServiceManager
 __construct (array $config=[])
 Constructor.
 
 getServiceLocator ()
 Implemented for backwards compatibility with previous plugin managers only.
 
 get ($name)
 
 
 build ($name, array $options=null)
 Build a service by its name, using optional options (such services are NEVER cached).
Parameters
string$name
null | array$options
Returns
mixed
Exceptions
Exception\ServiceNotFoundExceptionIf no factory/abstract factory could be found to create the instance.
Exception\ServiceNotCreatedExceptionIf factory/delegator fails to create the instance.
ContainerExceptionif any other error occurs

 
 has ($name)
 
 
 setAllowOverride ($flag)
 Indicate whether or not the instance is immutable.
 
 getAllowOverride ()
 Retrieve the flag indicating immutability status.
 
 configure (array $config)
 Configure the service manager.
 
 setAlias ($alias, $target)
 Add an alias.
 
 setInvokableClass ($name, $class=null)
 Add an invokable class mapping.
 
 setFactory ($name, $factory)
 Specify a factory for a given service name.
 
 mapLazyService ($name, $class=null)
 Create a lazy service mapping to a class.
 
 addAbstractFactory ($factory)
 Add an abstract factory for resolving services.
 
 addDelegator ($name, $factory)
 Add a delegator for a given service.
 
 addInitializer ($initializer)
 Add an initializer.
 
 setService ($name, $service)
 Map a service.
 
 setShared ($name, $flag)
 Add a service sharing rule.
 

Protected Attributes

 $aliases
 
 $factories
 
 $renderer
 
- Protected Attributes inherited from AbstractPluginManager
 $autoAddInvokableClass = true
 
 $instanceOf = null
 
- Protected Attributes inherited from ServiceManager
 $abstractFactories = []
 
 $aliases = []
 
 $allowOverride = false
 Whether or not changes may be made to this instance.
 
 $creationContext
 
 $delegators = []
 
 $factories = []
 
 $initializers = []
 
 $lazyServices = []
 
 $services = []
 
 $shared = []
 
 $sharedByDefault = true
 
 $configured = false
 

Detailed Description

Plugin manager implementation for view helpers.

Enforces that helpers retrieved are instances of Helper. Additionally, it registers a number of default helpers.

Constructor & Destructor Documentation

__construct (   $configOrContainerInstance = null,
array  $v3config = [] 
)

Constructor.

Merges provided configuration with default configuration.

Adds initializers to inject the attached renderer and translator, if any, to the currently requested helper.

Parameters
null | ConfigInterface | ContainerInterface$configOrContainerInstance
array$v3configIf $configOrContainerInstance is a container, this value will be passed to the parent constructor.

Member Function Documentation

getRenderer ( )

Retrieve renderer instance.

Returns
null|Renderer
injectEventManager (   $first,
  $second 
)

Inject a helper instance with the registered event manager.

Parameters
ContainerInterface | Helper\HelperInterface$firsthelper instance under zend-servicemanager v2, ContainerInterface under v3.
ContainerInterface | Helper\HelperInterface$secondContainerInterface under zend-servicemanager v3, helper instance under v2. Ignored regardless.
injectRenderer (   $first,
  $second 
)

Inject a helper instance with the registered renderer.

Parameters
ContainerInterface | Helper\HelperInterface$firsthelper instance under zend-servicemanager v2, ContainerInterface under v3.
ContainerInterface | Helper\HelperInterface$secondContainerInterface under zend-servicemanager v3, helper instance under v2. Ignored regardless.
injectTranslator (   $first,
  $second 
)

Inject a helper instance with the registered translator.

Parameters
ContainerInterface | Helper\HelperInterface$firsthelper instance under zend-servicemanager v2, ContainerInterface under v3.
ContainerInterface | Helper\HelperInterface$secondContainerInterface under zend-servicemanager v3, helper instance under v2. Ignored regardless.
setRenderer ( Renderer\RendererInterface  $renderer)

Set renderer.

Parameters
Renderer\RendererInterface$renderer
Returns
HelperPluginManager
validate (   $instance)

Validate the plugin is of the expected type (v3).

Validates against callables and HelperInterface implementations.

Parameters
mixed$instance
Exceptions
InvalidServiceException

Implements PluginManagerInterface.

validatePlugin (   $instance)

Validate the plugin is of the expected type (v2).

Proxies to `validate()`.

Parameters
mixed$instance
Exceptions
InvalidHelperException

Member Data Documentation

$aliases
protected
Initial value:
= [
'basePath' => Helper\BasePath::class
$factories
protected
Initial value:
= [
Helper\FlashMessenger::class => Helper\Service\FlashMessengerFactory::class
$renderer
protected