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

UserCreatorFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
dl 11
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
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\UserCreator;
14
use Interop\Container\ContainerInterface;
15
use Zend\ServiceManager\FactoryInterface;
16
use Zend\ServiceManager\ServiceLocatorInterface;
17
18
/**
19
 * Factory for an UserCreator plugin instance
20
 *
21
 * @author Mathias Gelhausen <[email protected]>
22
 * @since 0.20
23
 */
24 View Code Duplication
class UserCreatorFactory implements FactoryInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
{
26
    /**
27
     * Create a UserCreator controller plugin
28
     *
29
     * @param  ContainerInterface $container
30
     * @param  string             $requestedName
31
     * @param  null|array         $options
32
     *
33
     * @return UserCreator
34
     */
35
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
36
    {
37
        $filters  = $container->get('FilterManager');
38
39
        $dbNameExctractor = $filters->get('Install/DbNameExtractor');
40
        $credentialFilter = $filters->get('Auth/CredentialFilter');
41
42
        $plugin = new UserCreator($dbNameExctractor, $credentialFilter);
43
44
        return $plugin;
45
    }
46
47
    /**
48
     * Creates a UserCreator plugin instance.
49
     *
50
     * @param ServiceLocatorInterface $serviceLocator Controller plugin manager
51
     *
52
     * @return UserCreator
53
     */
54
    public function createService(ServiceLocatorInterface $serviceLocator)
55
    {
56
        /* @var $serviceLocator \Zend\Mvc\Controller\PluginManager */
57
        return $this($serviceLocator->getServiceLocator(), UserCreator::class);
58
    }
59
}
60