HttpClientFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
1
<?php
2
3
namespace ZfSnapGeoip;
4
5
use Zend\ServiceManager\FactoryInterface;
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use Zend\Http\Client;
8
9
class HttpClientFactory implements FactoryInterface
0 ignored issues
show
Bug introduced by
There is one abstract method __invoke in this class; you could implement it, or declare this class as abstract.
Loading history...
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...
10
{
11
12
    public function createService(ServiceLocatorInterface $serviceLocator)
13
    {
14
        /* @var $adapter Zend\Http\Client\Adapter\AdapterInterface */
15
        $adapter = $serviceLocator->get('ZfSnapGeoip\HttpClient\Adapter');
16
17
        $config = $serviceLocator->get('config');
18
        $options = $config['maxmind']['http_client']['options'];
19
20
        $client = new Client();
21
        $client->setAdapter($adapter);
22
        $client->setOptions($options);
23
24
        return $client;
25
    }
26
27
}
28