Code Duplication    Length = 21-29 lines in 6 locations

module/Auth/src/Auth/Factory/Controller/PasswordControllerFactory.php 1 location

@@ 20-46 (lines=27) @@
17
use Zend\ServiceManager\FactoryInterface;
18
use Zend\ServiceManager\ServiceLocatorInterface;
19
20
class PasswordControllerFactory implements FactoryInterface
21
{
22
23
    /**
24
     * Create service
25
     *
26
     * @param ServiceLocatorInterface $serviceLocator
27
     *
28
     * @return PasswordController
29
     */
30
    public function createService(ServiceLocatorInterface $serviceLocator)
31
    {
32
        /** @var ControllerManager $serviceLocator */
33
        $serviceLocator = $serviceLocator->getServiceLocator();
34
35
        /**
36
         * @var AuthenticationService $authenticationService
37
         * @var Form\UserPassword     $form
38
         * @var RepositoryService     $repositoryService
39
         */
40
        $authenticationService = $serviceLocator->get('AuthenticationService');
41
        $form = $serviceLocator->get('forms')->get('user-password');
42
        $repositoryService = $serviceLocator->get('repositories');
43
44
        return new PasswordController($authenticationService, $form, $repositoryService);
45
    }
46
}
47

module/Auth/src/Auth/Factory/Service/ForgotPasswordFactory.php 1 location

@@ 20-42 (lines=23) @@
17
use Zend\ServiceManager\FactoryInterface;
18
use Zend\ServiceManager\ServiceLocatorInterface;
19
20
class ForgotPasswordFactory implements FactoryInterface
21
{
22
    /**
23
     * Create service
24
     *
25
     * @param ServiceLocatorInterface $serviceLocator
26
     *
27
     * @return ForgotPassword
28
     */
29
    public function createService(ServiceLocatorInterface $serviceLocator)
30
    {
31
        /**
32
         * @var Repository\User          $userRepository
33
         * @var UserUniqueTokenGenerator $tokenGenerator
34
         */
35
        $userRepository = $serviceLocator->get('repositories')->get('Auth/User');
36
        $tokenGenerator = $serviceLocator->get('Auth\Service\UserUniqueTokenGenerator');
37
        $loginFilter = $serviceLocator->get('Auth\LoginFilter');
38
        $config = $serviceLocator->get('Auth/Options');
39
40
        return new ForgotPassword($userRepository, $tokenGenerator, $loginFilter, $config);
41
    }
42
}
43

module/Install/src/Factory/Controller/Plugin/UserCreatorFactory.php 1 location

@@ 23-45 (lines=23) @@
20
 * @author Mathias Gelhausen <[email protected]>
21
 * @since 0.20
22
 */
23
class UserCreatorFactory implements FactoryInterface
24
{
25
    /**
26
     * Creates a UserCreator plugin instance.
27
     *
28
     * @param ServiceLocatorInterface $serviceLocator Controller plugin manager
29
     *
30
     * @return UserCreator
31
     */
32
    public function createService(ServiceLocatorInterface $serviceLocator)
33
    {
34
        /* @var $serviceLocator \Zend\Mvc\Controller\PluginManager */
35
        $services = $serviceLocator->getServiceLocator();
36
        $filters  = $services->get('FilterManager');
37
38
        $dbNameExctractor = $filters->get('Install/DbNameExtractor');
39
        $credentialFilter = $filters->get('Auth/CredentialFilter');
40
41
        $plugin = new UserCreator($dbNameExctractor, $credentialFilter);
42
43
        return $plugin;
44
    }
45
}
46

module/Jobs/src/Jobs/Factory/Controller/ApiJobListByOrganizationControllerFactory.php 1 location

@@ 16-41 (lines=26) @@
13
use Zend\ServiceManager\FactoryInterface;
14
use Zend\ServiceManager\ServiceLocatorInterface;
15
16
class ApiJobListByOrganizationControllerFactory implements FactoryInterface
17
{
18
    /**
19
     * Create service
20
     *
21
     * @param ServiceLocatorInterface $serviceLocator
22
     *
23
     * @return ApiJobListByOrganizationController
24
     */
25
    public function createService(ServiceLocatorInterface $serviceLocator)
26
    {
27
        /* @var $serviceLocator \Zend\Mvc\Controller\PluginManager */
28
        $services = $serviceLocator->getServiceLocator();
29
        $repositories = $services->get('repositories');
30
31
        /** @var \Jobs\Repository\Job $jobRepository */
32
        $jobRepository = $repositories->get('Jobs');
33
34
        /** @var \Jobs\Model\ApiJobDehydrator $apiJobDehydrator */
35
        $apiJobDehydrator = $services->get('Jobs\Model\ApiJobDehydrator');
36
37
        $controller = new ApiJobListByOrganizationController($jobRepository, $apiJobDehydrator);
38
39
        return $controller;
40
    }
41
}

module/Auth/src/Auth/Factory/Controller/RegisterControllerFactory.php 1 location

@@ 21-49 (lines=29) @@
18
use Zend\ServiceManager\FactoryInterface;
19
use Zend\ServiceManager\ServiceLocatorInterface;
20
21
class RegisterControllerFactory implements FactoryInterface
22
{
23
24
    /**
25
     * Create service
26
     *
27
     * @param ServiceLocatorInterface $serviceLocator
28
     *
29
     * @return RegisterController
30
     */
31
    public function createService(ServiceLocatorInterface $serviceLocator)
32
    {
33
        /** @var ControllerManager $serviceLocator */
34
        $serviceLocator = $serviceLocator->getServiceLocator();
35
36
        /**
37
         * @var $form    Form\Register
38
         * @var $service Service\Register
39
         * @var $logger  LoggerInterface
40
         * @var $options  ModuleOptions
41
         */
42
        $form = $serviceLocator->get('Auth\Form\Register');
43
        $service = $serviceLocator->get('Auth\Service\Register');
44
        $logger = $serviceLocator->get('Core/Log');
45
        $options = $serviceLocator->get('Auth/Options');
46
47
        return new RegisterController($form, $service, $logger, $options);
48
    }
49
}
50

module/Jobs/src/Jobs/Factory/Controller/ManageControllerFactory.php 1 location

@@ 18-38 (lines=21) @@
15
use Zend\ServiceManager\FactoryInterface;
16
use Zend\ServiceManager\ServiceLocatorInterface;
17
18
class ManageControllerFactory implements FactoryInterface
19
{
20
    /**
21
     * Injects all needed services into the ManageController
22
     *
23
     * @param ServiceLocatorInterface $serviceLocator
24
     *
25
     * @return ManageController
26
     */
27
    public function createService(ServiceLocatorInterface $serviceLocator)
28
    {
29
        /* @var ControllerManager $serviceLocator */
30
        $serviceLocator = $serviceLocator->getServiceLocator();
31
        $auth = $serviceLocator->get('AuthenticationService');
32
        /* @var RepositoryService     $repositoryService */
33
        $repositoryService =    $serviceLocator->get('repositories');
34
35
        $translator =    $serviceLocator->get('translator');
36
        return new ManageController($auth, $repositoryService, $translator);
37
    }
38
}