Completed
Pull Request — master (#11)
by Vytautas
03:07
created

DoctrineStorageFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Svycka\SocialUser\Storage\Factory;
4
5
use Laminas\ServiceManager\Factory\FactoryInterface;
6
use Interop\Container\ContainerInterface;
7
use Svycka\SocialUser\Storage\Doctrine;
8
9
/**
10
 * @author Vytautas Stankus <[email protected]>
11
 * @license MIT
12
 */
13
final class DoctrineStorageFactory implements FactoryInterface
14
{
15 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
16
    {
17 1
        $entityManager = $container->get('doctrine.entitymanager.orm_default');
18
19 1
        $config = $container->get('config')['svycka_social_user'];
20
        $options = [
21 1
            'social_user_entity' => $config['social_user_entity'],
22
        ];
23
24 1
        return new Doctrine($entityManager, $options);
25
    }
26
}
27