Completed
Pull Request — 1.x (#627)
by Dylan
08:40
created

Db::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace ZfcUser\Factory\Authentication\Adapter;
4
5
use Zend\ServiceManager\FactoryInterface;
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use ZfcUser\Authentication\Adapter\Db as DbAdapter;
8
use ZfcUser\Mapper\UserInterface;
9
use ZfcUser\Options\AuthenticationOptionsInterface;
10
use ZfcUser\Options\ModuleOptions;
11
12
class Db implements FactoryInterface
13
{
14
    /**
15
     * Create service
16
     *
17
     * @param ServiceLocatorInterface $serviceLocator
18
     * @return mixed
19
     */
20
    public function createService(ServiceLocatorInterface $serviceLocator)
21
    {
22
        /** @var UserInterface $mapper */
23
        $mapper = $serviceLocator->get('zfcuser_user_mapper');
24
        /** @var AuthenticationOptionsInterface $options */
25
        $options = $serviceLocator->get('zfcuser_module_options');
26
        return new DbAdapter(
27
            $mapper,
28
            $options
29
        );
30
    }
31
}
32