LmcUserAuthentication::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace LmcUser\Factory\Controller\Plugin;
4
5
use Interop\Container\ContainerInterface;
6
use Laminas\ServiceManager\Factory\FactoryInterface;
7
use Laminas\ServiceManager\ServiceLocatorInterface;
8
use LmcUser\Controller;
9
10
class LmcUserAuthentication implements FactoryInterface
11
{
12
    public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null)
13
    {
14
        $authService = $serviceLocator->get('lmcuser_auth_service');
15
        $authAdapter = $serviceLocator->get('LmcUser\Authentication\Adapter\AdapterChain');
16
17
        $controllerPlugin = new Controller\Plugin\LmcUserAuthentication;
18
        $controllerPlugin->setAuthService($authService);
19
        $controllerPlugin->setAuthAdapter($authAdapter);
20
21
        return $controllerPlugin;
22
    }
23
24
    /**
25
     * Create service
26
     *
27
     * @param  ServiceLocatorInterface $serviceManager
28
     * @return mixed
29
     */
30
    public function createService(ServiceLocatorInterface $serviceManager)
31
    {
32
        $serviceLocator = $serviceManager->getServiceLocator();
33
34
        return $this->__invoke($serviceLocator, null);
35
    }
36
}
37