ZfcUserAuthenticationFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 1
eloc 9
nc 1
nop 1
1
<?php
2
namespace ZfcUser\Factory\Controller\Plugin;
3
4
use Zend\Authentication\AuthenticationService;
5
use Zend\Mvc\Controller\PluginManager;
6
use Zend\ServiceManager\FactoryInterface;
7
use Zend\ServiceManager\ServiceLocatorInterface;
8
use ZfcUser\Authentication\Adapter;
9
use ZfcUser\Controller\Plugin\ZfcUserAuthentication;
10
11
class ZfcUserAuthenticationFactory implements FactoryInterface
12
{
13
    /**
14
     * {@inheritDoc}
15
     */
16
    public function createService(ServiceLocatorInterface $pluginManager)
17
    {
18
        /* @var $pluginManager PluginManager */
19
        $serviceManager = $pluginManager->getServiceLocator();
20
21
        /* @var $authService AuthenticationService */
22
        $authService = $serviceManager->get('zfcuser_auth_service');
23
24
        /* @var $authAdapter Adapter\AdapterChain */
25
        $authAdapter = $serviceManager->get('ZfcUser\Authentication\Adapter\AdapterChain');
26
27
        $controllerPlugin = new ZfcUserAuthentication;
28
        $controllerPlugin
29
            ->setAuthService($authService)
30
            ->setAuthAdapter($authAdapter)
31
        ;
32
33
        return $controllerPlugin;
34
    }
35
}
36