ZfcUserAuthenticationFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 19 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