createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoDraw for the canonical source repository
6
 * @copyright   Copyright (c) 2012-2017 Webino, s. r. o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoDraw\Factory;
12
13
use WebinoDraw\Dom\Factory\NodeListFactory;
14
use WebinoDraw\Dom\Locator;
15
use WebinoDraw\Instructions\InstructionsRendererInterface;
16
use WebinoDraw\Options\ModuleOptions;
17
use Zend\ServiceManager\FactoryInterface;
18
use Zend\ServiceManager\ServiceLocatorInterface;
19
20
/**
21
 * Class AbstractInstructionsRendererFactory
22
 */
23
abstract class AbstractInstructionsRendererFactory implements FactoryInterface
24
{
25
    /**
26
     * Instructions renderer class
27
     */
28
    const ENGINE_CLASS = InstructionsRendererInterface::class;
29
30
    /**
31
     * @param ServiceLocatorInterface $services
32
     * @return InstructionsRendererInterface
33
     */
34
    public function createService(ServiceLocatorInterface $services)
35
    {
36
        /** @var Locator $domLocator */
37
        $domLocator = $services->get(Locator::class);
38
39
        $rendererClass = $this::ENGINE_CLASS;
40
        return new $rendererClass(
41
            $services->get('WebinoDrawHelperManager'),
42
            $domLocator,
43
            new NodeListFactory($domLocator),
44
            new InstructionsFactory,
45
            $services->get(ModuleOptions::SERVICE)
46
        );
47
    }
48
}
49