use zend router
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / Mvc / Service / ViewPrefixPathStackResolverFactory.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\Resolver\PrefixPathStackResolver;
16
17 class ViewPrefixPathStackResolverFactory implements FactoryInterface
18 {
19 /**
20 * Create the template prefix view resolver
21 *
22 * Creates a Zend\View\Resolver\PrefixPathStackResolver and populates it with the
23 * ['view_manager']['prefix_template_path_stack']
24 *
25 * @param ContainerInterface $container
26 * @param string $name
27 * @param null|array $options
28 * @return PrefixPathStackResolver
29 */
30 public function __invoke(ContainerInterface $container, $name, array $options = null)
31 {
32 $config = $container->get('config');
33 $prefixes = [];
34
35 if (isset($config['view_manager']['prefix_template_path_stack'])) {
36 $prefixes = $config['view_manager']['prefix_template_path_stack'];
37 }
38
39 return new PrefixPathStackResolver($prefixes);
40 }
41
42 /**
43 * Create and return PrefixPathStackResolver instance
44 *
45 * For use with zend-servicemanager v2; proxies to __invoke().
46 *
47 * @param ServiceLocatorInterface $container
48 * @return PrefixPathStackResolver
49 */
50 public function createService(ServiceLocatorInterface $container)
51 {
52 return $this($container, PrefixPathStackResolver::class);
53 }
54 }