User   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 20 1
1
<?php
2
3
namespace LmcUser\Factory\Mapper;
4
5
use Interop\Container\ContainerInterface;
6
use Laminas\ServiceManager\Factory\FactoryInterface;
7
use LmcUser\Mapper;
8
use LmcUser\Options\ModuleOptions;
9
10
class User implements FactoryInterface
11
{
12
    /**
13
     * {@inheritDoc}
14
     * @see \Laminas\ServiceManager\Factory\FactoryInterface::__invoke()
15
     */
16
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
17
    {
18
        /**
19
         * @var ModuleOptions $options
20
         */
21
        $options = $container->get('lmcuser_module_options');
22
        $dbAdapter = $container->get('lmcuser_laminas_db_adapter');
23
        $hydrator = $container->get('lmcuser_user_hydrator');
24
25
        $entityClass = $options->getUserEntityClass();
26
        $tableName = $options->getTableName();
27
28
        $mapper = new Mapper\User();
29
        $mapper->setDbAdapter($dbAdapter);
30
        $mapper->setTableName($tableName);
31
        $mapper->setEntityPrototype(new $entityClass);
32
        $mapper->setHydrator($hydrator);
33
34
        return $mapper;
35
    }
36
}
37