Commit | Line | Data |
---|---|---|
44d399bc S |
1 | <?php |
2 | /** | |
3 | * Zend Framework (http://framework.zend.com/) | |
4 | * | |
5 | * @link http://github.com/zendframework/zf2 for the canonical source repository | |
6 | * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | |
7 | * @license http://framework.zend.com/license/new-bsd New BSD License | |
8 | */ | |
9 | ||
10 | namespace Zend\Mvc\Service; | |
11 | ||
12 | use Interop\Container\ContainerInterface; | |
13 | use Zend\Mvc\DispatchListener; | |
14 | use Zend\ServiceManager\FactoryInterface; | |
15 | use Zend\ServiceManager\ServiceLocatorInterface; | |
16 | ||
17 | class DispatchListenerFactory implements FactoryInterface | |
18 | { | |
19 | /** | |
20 | * Create the default dispatch listener. | |
21 | * | |
22 | * @param ContainerInterface $container | |
23 | * @param string $name | |
24 | * @param null|array $options | |
25 | * @return DispatchListener | |
26 | */ | |
27 | public function __invoke(ContainerInterface $container, $name, array $options = null) | |
28 | { | |
29 | return new DispatchListener($container->get('ControllerManager')); | |
30 | } | |
31 | ||
32 | /** | |
33 | * Create and return DispatchListener instance | |
34 | * | |
35 | * For use with zend-servicemanager v2; proxies to __invoke(). | |
36 | * | |
37 | * @param ServiceLocatorInterface $container | |
38 | * @return DispatchListener | |
39 | */ | |
40 | public function createService(ServiceLocatorInterface $container) | |
41 | { | |
42 | return $this($container, DispatchListener::class); | |
43 | } | |
44 | } |