use zend router
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / Mvc / Service / ConsoleViewManagerFactory.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\Console\Console;
14 use Zend\ServiceManager\Exception\ServiceNotCreatedException;
15 use Zend\ServiceManager\FactoryInterface;
16 use Zend\ServiceManager\ServiceLocatorInterface;
17 use Zend\Mvc\View\Console\ViewManager as ConsoleViewManager;
18
19 class ConsoleViewManagerFactory implements FactoryInterface
20 {
21 /**
22 * Create and return the view manager for the console environment
23 *
24 * @param ContainerInterface $container
25 * @param string $name
26 * @param null|array $options
27 * @return ConsoleViewManager
28 */
29 public function __invoke(ContainerInterface $container, $name, array $options = null)
30 {
31 if (! Console::isConsole()) {
32 throw new ServiceNotCreatedException(
33 'ConsoleViewManager requires a Console environment; console environment not detected'
34 );
35 }
36
37 return new ConsoleViewManager();
38 }
39
40 /**
41 * Create and return ConsoleViewManager instance
42 *
43 * For use with zend-servicemanager v2; proxies to __invoke().
44 *
45 * @param ServiceLocatorInterface $container
46 * @return ConsoleViewManager
47 */
48 public function createService(ServiceLocatorInterface $container)
49 {
50 return $this($container, ConsoleViewManager::class);
51 }
52 }