3 * Zend Framework (http://framework.zend.com/)
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
10 namespace Zend\Mvc\Service
;
12 use Interop\Container\ContainerInterface
;
13 use Zend\Mvc\View\Http\InjectTemplateListener
;
14 use Zend\ServiceManager\FactoryInterface
;
15 use Zend\ServiceManager\ServiceLocatorInterface
;
17 class InjectTemplateListenerFactory
implements FactoryInterface
22 * Create and return an InjectTemplateListener instance.
24 * @return InjectTemplateListener
26 public function __invoke(ContainerInterface
$container, $name, array $options = null)
28 $listener = new InjectTemplateListener();
29 $config = $container->get('config');
31 if (isset($config['view_manager']['controller_map'])
32 && (is_array($config['view_manager']['controller_map']))
34 $listener->setControllerMap($config['view_manager']['controller_map']);
41 * Create and return InjectTemplateListener instance
43 * For use with zend-servicemanager v2; proxies to __invoke().
45 * @param ServiceLocatorInterface $container
46 * @return InjectTemplateListener
48 public function createService(ServiceLocatorInterface
$container)
50 return $this($container, InjectTemplateListener
::class);