@@ 20-53 (lines=34) @@ | ||
17 | * |
|
18 | * @package Nnx\Container\EntryNameResolver |
|
19 | */ |
|
20 | class DefaultEntryNameResolverFactory implements FactoryInterface |
|
21 | { |
|
22 | /** |
|
23 | * @inheritdoc |
|
24 | * |
|
25 | * @param ServiceLocatorInterface $serviceLocator |
|
26 | * |
|
27 | * @return DefaultEntryNameResolver |
|
28 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
|
29 | */ |
|
30 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
31 | { |
|
32 | $appServiceLocator = $serviceLocator; |
|
33 | if ($serviceLocator instanceof AbstractPluginManager) { |
|
34 | $appServiceLocator = $serviceLocator->getServiceLocator(); |
|
35 | } |
|
36 | ||
37 | /** @var ModuleOptionsPluginManagerInterface $moduleOptionsPluginManager */ |
|
38 | $moduleOptionsPluginManager = $appServiceLocator->get(ModuleOptionsPluginManagerInterface::class); |
|
39 | ||
40 | /** @var ModuleOptions $moduleOptions */ |
|
41 | $moduleOptions = $moduleOptionsPluginManager->get(ModuleOptions::class); |
|
42 | $entryNameResolversConfig = $moduleOptions->getEntryNameResolvers(); |
|
43 | ||
44 | $creationOptions = [ |
|
45 | 'resolvers' => $entryNameResolversConfig, |
|
46 | 'className' => DefaultEntryNameResolver::class |
|
47 | ]; |
|
48 | ||
49 | $entryNameResolverChain = $serviceLocator->get(EntryNameResolverChain::class, $creationOptions); |
|
50 | ||
51 | return $entryNameResolverChain; |
|
52 | } |
|
53 | } |
|
54 |
@@ 21-54 (lines=34) @@ | ||
18 | * |
|
19 | * @package Nnx\Container\EntryNameResolver |
|
20 | */ |
|
21 | class ResolverByModuleContextMapFactory implements FactoryInterface |
|
22 | { |
|
23 | /** |
|
24 | * @inheritdoc |
|
25 | * |
|
26 | * @param ServiceLocatorInterface $serviceLocator |
|
27 | * |
|
28 | * @return ResolverByModuleContextMap |
|
29 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
|
30 | */ |
|
31 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
32 | { |
|
33 | $appServiceLocator = $serviceLocator; |
|
34 | if ($serviceLocator instanceof AbstractPluginManager) { |
|
35 | $appServiceLocator = $serviceLocator->getServiceLocator(); |
|
36 | } |
|
37 | ||
38 | /** @var ModuleOptionsPluginManagerInterface $moduleOptionsPluginManager */ |
|
39 | $moduleOptionsPluginManager = $appServiceLocator->get(ModuleOptionsPluginManagerInterface::class); |
|
40 | ||
41 | /** @var ModuleOptions $moduleOptions */ |
|
42 | $moduleOptions = $moduleOptionsPluginManager->get(ModuleOptions::class); |
|
43 | $contextMap = $moduleOptions->getContextMap(); |
|
44 | ||
45 | $creationOptions = [ |
|
46 | 'contextMap' => $contextMap, |
|
47 | 'className' => ResolverByModuleContextMap::class |
|
48 | ]; |
|
49 | ||
50 | $entryNameResolverChain = $serviceLocator->get(BaseResolverByModuleContextMap::class, $creationOptions); |
|
51 | ||
52 | return $entryNameResolverChain; |
|
53 | } |
|
54 | } |
|
55 |