use zend router
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / Mvc / Service / ViewFactory.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\ServiceManager\FactoryInterface;
14 use Zend\ServiceManager\ServiceLocatorInterface;
15 use Zend\View\Strategy\PhpRendererStrategy;
16 use Zend\View\View;
17
18 class ViewFactory implements FactoryInterface
19 {
20 /**
21 * @param ContainerInterface $container
22 * @param string $name
23 * @param null|array $options
24 * @return View
25 */
26 public function __invoke(ContainerInterface $container, $name, array $options = null)
27 {
28 $view = new View();
29 $events = $container->get('EventManager');
30
31 $view->setEventManager($events);
32 $container->get(PhpRendererStrategy::class)->attach($events);
33
34 return $view;
35 }
36
37 /**
38 * Create and return View instance
39 *
40 * For use with zend-servicemanager v2; proxies to __invoke().
41 *
42 * @param ServiceLocatorInterface $container
43 * @return View
44 */
45 public function createService(ServiceLocatorInterface $container)
46 {
47 return $this($container, View::class);
48 }
49 }