ProxyDriverFactory::createService()   A
last analyzed

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
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Fabiang\DoctrineDynamic\Service;
4
5
use Fabiang\DoctrineDynamic\ProxyDriver;
6
use Fabiang\DoctrineDynamic\Configuration;
7
use Fabiang\DoctrineDynamic\ProxyDriverFactory as BaseProxyDriverFactory;
8
use Doctrine\ORM\EntityManager;
9
use Interop\Container\ContainerInterface;
10
use Zend\ServiceManager\FactoryInterface;
11
use Zend\ServiceManager\ServiceLocatorInterface;
12
13
final class ProxyDriverFactory extends BaseProxyDriverFactory implements
14
    FactoryInterface
15
{
16
    /**
17
     * @param ContainerInterface $container
18
     * @param string $requestedName
19
     * @param array $options
20
     * @return ProxyDriver[]
21
     */
22 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
23
    {
24 1
        $entityManager = $container->get(EntityManager::class);
25 1
        $configuration = $container->get(Configuration::class);
26 1
        return $this->factory($entityManager, $configuration);
27
    }
28
29
    /**
30
     * @param ServiceLocatorInterface $serviceLocator
31
     * @return ProxyDriver
32
     */
33 1
    public function createService(ServiceLocatorInterface $serviceLocator)
34
    {
35 1
        return $this($serviceLocator, ProxyDriver::class);
36
    }
37
}
38