Interface AbstractFactoryInterface

Summary

Fully Qualified Name: Zend\ServiceManager\Factory\AbstractFactoryInterface
Extends: FactoryInterface

Description

Interface for an abstract factory.

An abstract factory extends the factory interface, but also has an additional "canCreate" method, which is called to check if the abstract factory has the ability to create an instance for the given service. You should limit the number of abstract factories to ensure good performance. Starting from ServiceManager v3, remember that you can also attach multiple names to the same factory, which reduces the need for abstract factories.

Methods

Name Description Defined By
__invoke() Create an object FactoryInterface
canCreate() Can the factory create an instance for the service? AbstractFactoryInterface

Method Details

__invoke()

Create an object

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

Returns: object

canCreate()

Can the factory create an instance for the service?

Parameter Name Type Description
$container \ContainerInterface
$requestedName string

Returns: bool

Top