GeoipFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
A createService() 0 8 2
1
<?php
2
3
namespace ZfSnapGeoip\View\Helper;
4
5
use Interop\Container\ContainerInterface;
6
use Zend\ServiceManager\AbstractPluginManager;
7
use Zend\ServiceManager\FactoryInterface;
8
use Zend\ServiceManager\ServiceLocatorInterface;
9
10
final class GeoipFactory 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
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
13
    {
14
        $geoip = $container->get('geoip');
15
16
        return new Geoip($geoip);
17
    }
18
19
    public function createService(ServiceLocatorInterface $serviceLocator)
20
    {
21
        if ($serviceLocator instanceof AbstractPluginManager) {
22
            $serviceLocator = $serviceLocator->getServiceLocator();
0 ignored issues
show
Deprecated Code introduced by
The method Zend\ServiceManager\Serv...er::getServiceLocator() has been deprecated with message: since 3.0.0. Factories using 3.0 should use the container instance passed to the factory instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

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

Loading history...
23
        }
24
25
        return $this($serviceLocator, Geoip::class);
26
    }
27
}
28