Passed
Pull Request — master (#2)
by Alex
02:56
created

EntityManagerContainerFactory::__invoke()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 1
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDoctrine\Factory\Service;
6
7
use Arp\LaminasDoctrine\Service\EntityManager\EntityManagerContainer;
8
use Arp\LaminasFactory\AbstractFactory;
9
use Interop\Container\ContainerInterface;
10
use Laminas\ServiceManager\Exception\InvalidArgumentException;
11
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
12
13
/**
14
 * @author  Alex Patterson <[email protected]>
15
 * @package Arp\LaminasDoctrine\Factory\Service
16
 */
17
final class EntityManagerContainerFactory extends AbstractFactory
18
{
19
    /**
20
     * @param ContainerInterface $container
21
     * @param string             $requestedName
22
     * @param array|null         $options
23
     *
24
     * @return EntityManagerContainer
25
     *
26
     * @noinspection PhpMissingParamTypeInspection
27
     *
28
     * @throws InvalidArgumentException
29
     * @throws ServiceNotFoundException
30
     */
31
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null): EntityManagerContainer
32
    {
33
        $config = $this->getApplicationOptions($container, 'entity_manager_container') ?: [];
34
35
        return new EntityManagerContainer($container, $config);
36
    }
37
}
38