Completed
Push — develop ( 975a05...8c983c )
by
unknown
07:04
created

YawikConfigCreatorFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 3
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license    MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
10
/** */
11
namespace Install\Factory\Controller\Plugin;
12
13
use Install\Controller\Plugin\YawikConfigCreator;
14
use Interop\Container\ContainerInterface;
15
use Zend\ServiceManager\FactoryInterface;
16
use Zend\ServiceManager\ServiceLocatorInterface;
17
18
/**
19
 * Factory for a YawikConfigCreator plugin instance.
20
 *
21
 * @author Mathias Gelhausen <[email protected]>
22
 * @since  0.20
23
 */
24
class YawikConfigCreatorFactory implements FactoryInterface
25
{
26
    /**
27
     * Create a YawikConfigCreator controller plugin
28
     *
29
     * @param  ContainerInterface $container
30
     * @param  string             $requestedName
31
     * @param  null|array         $options
32
     *
33
     * @return YawikConfigCreator
34
     */
35
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
36
    {
37
        $filters         = $container->get('FilterManager');
38
        $dbNameExtractor = $filters->get('Install/DbNameExtractor');
39
40
        $plugin = new YawikConfigCreator($dbNameExtractor);
41
42
        return $plugin;
43
    }
44
45
    /**
46
     * Creates a YawikConfigCreator plugin instance.
47
     *
48
     * @param ServiceLocatorInterface|\Zend\Mvc\Controller\PluginManager $serviceLocator
49
     *
50
     * @return YawikConfigCreator
51
     */
52
    public function createService(ServiceLocatorInterface $serviceLocator)
53
    {
54
        /* @var $serviceLocator \Zend\Mvc\Controller\PluginManager */
55
        return $this($serviceLocator->getServiceLocator(), YawikConfigCreator::class);
56
    }
57
}
58