ProxyFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1
Metric Value
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
crap 1
1
<?php
2
namespace mxdiModule\Factory;
3
4
use Zend\ServiceManager\FactoryInterface;
5
use Zend\ServiceManager\ServiceLocatorInterface;
6
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
7
use ProxyManager\Configuration;
8
9
class ProxyFactory implements FactoryInterface
10
{
11
    /**
12
     * Create service
13
     *
14
     * @param ServiceLocatorInterface $serviceLocator
15
     * @return Configuration
16
     */
17 1
    public function createService(ServiceLocatorInterface $serviceLocator)
18
    {
19 1
        $config = $serviceLocator->get('config')['mxdimodule'];
20
21 1
        $configuration = new Configuration();
22 1
        $configuration->setProxiesNamespace($config['proxy_namespace']);
23 1
        $configuration->setProxiesTargetDir($config['proxy_dir']);
24
25 1
        spl_autoload_register($configuration->getProxyAutoloader());
26
27 1
        return new LazyLoadingValueHolderFactory($configuration);
28
    }
29
}
30