@@ 18-39 (lines=22) @@ | ||
15 | * |
|
16 | * @package Nnx\FormComparator\Comparator |
|
17 | */ |
|
18 | class FormComparatorFactory implements FactoryInterface |
|
19 | { |
|
20 | /** |
|
21 | * @inheritdoc |
|
22 | * |
|
23 | * @param ServiceLocatorInterface $serviceLocator |
|
24 | * |
|
25 | * @return FormComparator |
|
26 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
|
27 | */ |
|
28 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
29 | { |
|
30 | $appServiceLocator = $serviceLocator instanceof AbstractPluginManager ? $serviceLocator->getServiceLocator() : $serviceLocator; |
|
31 | ||
32 | /** @var FormDiffService $formDiffBuilder */ |
|
33 | $formDiffBuilder = $appServiceLocator->get(FormDiffService::class); |
|
34 | Assert::isInstanceOf($formDiffBuilder, FormDiffService::class); |
|
35 | ||
36 | return new FormComparator($formDiffBuilder); |
|
37 | } |
|
38 | ||
39 | } |
|
40 |
@@ 19-40 (lines=22) @@ | ||
16 | * |
|
17 | * @package Nnx\FormComparator\Context |
|
18 | */ |
|
19 | class ContextBuilderFactory implements FactoryInterface |
|
20 | { |
|
21 | /** |
|
22 | * @inheritdoc |
|
23 | * |
|
24 | * @param ServiceLocatorInterface $serviceLocator |
|
25 | * |
|
26 | * @return ContextBuilder |
|
27 | * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException |
|
28 | */ |
|
29 | public function createService(ServiceLocatorInterface $serviceLocator) |
|
30 | { |
|
31 | $appServiceLocator = $serviceLocator instanceof AbstractPluginManager ? $serviceLocator->getServiceLocator() : $serviceLocator; |
|
32 | ||
33 | /** @var FormElementManager $formElementManager */ |
|
34 | $formElementManager = $appServiceLocator->get('FormElementManager'); |
|
35 | Assert::isInstanceOf($formElementManager, FormElementManager::class); |
|
36 | ||
37 | return new ContextBuilder($formElementManager); |
|
38 | } |
|
39 | ||
40 | } |
|
41 |