ZendDbAdapterFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
A createService() 0 4 1
1
<?php
2
3
namespace ZfcDatagrid\Service;
4
5
use Interop\Container\ContainerInterface;
6
use Zend\Db\Adapter\Adapter;
7
use Zend\ServiceManager\FactoryInterface;
8
use Zend\ServiceManager\ServiceLocatorInterface;
9
10
class ZendDbAdapterFactory 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...
11
{
12
    /**
13
     * @param ContainerInterface $container
14
     * @param string             $requestedName
15
     * @param array|null         $options
16
     *
17
     * @return Adapter
18
     */
19
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
20
    {
21
        $config = $container->get('config');
22
23
        return new Adapter($config['zfcDatagrid_dbAdapter']);
24
    }
25
26
    /**
27
     * @param ServiceLocatorInterface $serviceLocator
28
     *
29
     * @return Adapter
30
     */
31
    public function createService(ServiceLocatorInterface $serviceLocator)
32
    {
33
        return $this($serviceLocator, Adapter::class);
34
    }
35
}
36