0e059b920e08f46cafbc689535a709e5dc08dbeb
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / Mvc / Service / InjectTemplateListenerFactory.php
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\View\Http\InjectTemplateListener;
14 use Zend\ServiceManager\FactoryInterface;
15 use Zend\ServiceManager\ServiceLocatorInterface;
16
17 class InjectTemplateListenerFactory implements FactoryInterface
18 {
19 /**
20 * {@inheritDoc}
21 *
22 * Create and return an InjectTemplateListener instance.
23 *
24 * @return InjectTemplateListener
25 */
26 public function __invoke(ContainerInterface $container, $name, array $options = null)
27 {
28 $listener = new InjectTemplateListener();
29 $config = $container->get('config');
30
31 if (isset($config['view_manager']['controller_map'])
32 && (is_array($config['view_manager']['controller_map']))
33 ) {
34 $listener->setControllerMap($config['view_manager']['controller_map']);
35 }
36
37 return $listener;
38 }
39
40 /**
41 * Create and return InjectTemplateListener instance
42 *
43 * For use with zend-servicemanager v2; proxies to __invoke().
44 *
45 * @param ServiceLocatorInterface $container
46 * @return InjectTemplateListener
47 */
48 public function createService(ServiceLocatorInterface $container)
49 {
50 return $this($container, InjectTemplateListener::class);
51 }
52 }