DatabaseConfigFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 15
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createService() 0 4 1
A __invoke() 0 7 1
1
<?php
2
3
namespace ZfSnapGeoip;
4
5
use Interop\Container\ContainerInterface;
6
use Zend\ServiceManager\FactoryInterface;
7
use Zend\ServiceManager\ServiceLocatorInterface;
8
9
/**
10
 * Factory of DatabaseConfig
11
 *
12
 * @author Witold Wasiczko <[email protected]>
13
 */
14
class DatabaseConfigFactory implements FactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Zend\ServiceManager\FactoryInterface has been deprecated with message: Use Zend\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
15
{
16
    public function createService(ServiceLocatorInterface $serviceLocator)
17
    {
18
        return $this($serviceLocator, DatabaseConfig::class);
19
    }
20
21
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
22
    {
23
        $config = $container->get('config');
24
        $data = $config['maxmind']['database'];
25
26
        return new DatabaseConfig($data);
27
    }
28
}
29