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

IpAddressMiddlewareFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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