Class RouteInvokableFactory

Summary

Fully Qualified Name: Zend\Router\RouteInvokableFactory
Implements: AbstractFactoryInterface, FactoryInterface

Description

Specialized invokable/abstract factory for use with RoutePluginManager.

Can be mapped directly to specific route plugin names, or used as an abstract factory to map FQCN services to invokables.

Methods

Name Description Defined By
__invoke() Create and return a RouteInterface instance. RouteInvokableFactory
canCreate() Can we create a route instance with the given name? (v3) RouteInvokableFactory
canCreateServiceWithName() Can we create a route instance with the given name? (v2) RouteInvokableFactory
createService() Create and return RouteInterface instance RouteInvokableFactory
createServiceWithName() Create a route instance with the given name. (v2) RouteInvokableFactory
setCreationOptions() Set options to use when creating a service (v2) RouteInvokableFactory

Method Details

__invoke()

Create and return a RouteInterface instance.

If the specified $routeName class does not exist or does not implement RouteInterface, this method will raise an exception.

Otherwise, it uses the class' factory() method with the provided $options to produce an instance.

Parameter Name Type Description
$container \ContainerInterface
$routeName string
$options null|array

Returns: \RouteInterface

canCreate()

Can we create a route instance with the given name? (v3)

Only works for FQCN $routeName values, for classes that implement RouteInterface.

Parameter Name Type Description
$container \ContainerInterface
$routeName string

Returns: bool

canCreateServiceWithName()

Can we create a route instance with the given name? (v2)

Proxies to canCreate().

Parameter Name Type Description
$container \ServiceLocatorInterface
$normalizedName string
$routeName string

Returns: bool

createService()

Create and return RouteInterface instance

For use with zend-servicemanager v2; proxies to __invoke().

Parameter Name Type Description
$container \ServiceLocatorInterface
$normalizedName
$routeName

Returns: \RouteInterface

createServiceWithName()

Create a route instance with the given name. (v2)

Proxies to __invoke().

Parameter Name Type Description
$container \ServiceLocatorInterface
$normalizedName string
$routeName string

Returns: \RouteInterface

setCreationOptions()

Set options to use when creating a service (v2)

Parameter Name Type Description
$creationOptions array

Returns:

Top