Completed
Push — master ( 1de050...162d05 )
by Alejandro
46:23 queued 09:21
created

IpAddressMiddlewareFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\Common\Middleware;
5
6
use Interop\Container\ContainerInterface;
7
use RKA\Middleware\IpAddress;
8
use Shlinkio\Shlink\Core\Model\Visitor;
9
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
10
use Zend\ServiceManager\Exception\ServiceNotFoundException;
11
use Zend\ServiceManager\Factory\FactoryInterface;
12
13
class IpAddressMiddlewareFactory implements FactoryInterface
14
{
15
    /**
16
     * Create an object
17
     *
18
     * @param  ContainerInterface $container
19
     * @param  string $requestedName
20
     * @param  null|array $options
21
     * @throws ServiceNotFoundException if unable to resolve the service.
22
     * @throws ServiceNotCreatedException if an exception is raised when creating a service.
23
     */
24 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null): IpAddress
25
    {
26 1
        return new IpAddress(true, [], Visitor::REMOTE_ADDRESS_ATTR);
27
    }
28
}
29