EntityRepositoryFactoryFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 3
dl 0
loc 9
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasEntity\Factory\Service;
6
7
use Arp\LaminasEntity\Service\EntityRepositoryFactory;
8
use Arp\LaminasEntity\Service\EntityRepositoryManager;
9
use Arp\LaminasFactory\AbstractFactory;
10
use Doctrine\ORM\Repository\DefaultRepositoryFactory;
11
use Interop\Container\ContainerInterface;
12
13
/**
14
 * @author  Alex Patterson <[email protected]>
15
 * @package Arp\LaminasEntity\Factory\Service
16
 */
17
final class EntityRepositoryFactoryFactory extends AbstractFactory
18
{
19
    /**
20
     * @param ContainerInterface $container
21
     * @param string             $requestedName
22
     * @param array|null         $options
23
     *
24
     * @return EntityRepositoryFactory
25
     */
26
    public function __invoke(
27
        ContainerInterface $container,
28
        $requestedName,
29
        array $options = null
30
    ): EntityRepositoryFactory {
31
        /** @var EntityRepositoryManager $repositoryManager */
32
        $repositoryManager = $this->getService($container, EntityRepositoryManager::class, $requestedName);
33
34
        return new EntityRepositoryFactory($repositoryManager, new DefaultRepositoryFactory());
35
    }
36
}
37