UtilisateurControllerFactory.php 1.62 KB
Newer Older
1 2 3 4
<?php

namespace UnicaenAuth\Controller;

5
use Interop\Container\ContainerInterface;
6 7 8 9 10
use UnicaenApp\Mapper\Ldap\People as LdapPeopleMapper;
use UnicaenAuth\Options\ModuleOptions;
use UnicaenAuth\Service\ShibService;
use UnicaenAuth\Service\UserContext;
use Zend\Authentication\AuthenticationService;
11
use ZfcUser\Mapper\UserInterface;
12 13 14 15

class UtilisateurControllerFactory
{
    /**
16
     * @param ContainerInterface $container
17 18
     * @return UtilisateurController
     */
19
    public function __invoke(ContainerInterface $container)
20
    {
21
        /** @var UserInterface $mapper */
22
        $userMapper = $container->get('zfcuser_user_mapper');
23 24

        /** @var AuthenticationService $authenticationService */
25
        $authenticationService = $container->get(AuthenticationService::class);
26 27

        /** @var ModuleOptions $options */
28
        $options = $container->get('unicaen-auth_module_options');
29 30

        /** @var ShibService $shibService */
31
        $shibService = $container->get(ShibService::class);
32

33
        /** @var UserContext $userContextService */
34
        $userContextService = $container->get('AuthUserContext');
35 36

        /** @var LdapPeopleMapper $mapper */
37
        $ldapPeopleMapper = $container->get('ldap_people_mapper');
38 39 40

        $controller = new UtilisateurController();
        $controller->setLdapPeopleMapper($ldapPeopleMapper);
41
        $controller->setServiceUserContext($userContextService);
42 43 44 45
        $controller->setOptions($options);
        $controller->setShibService($shibService);
        $controller->setAuthenticationService($authenticationService);
        $controller->setUserMapper($userMapper);
46 47 48 49

        return $controller;
    }
}