Completed
Pull Request — master (#199)
by Alejandro
02:49
created

DeleteShortUrlsOptionsFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 5 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\Core\Options;
5
6
use Interop\Container\ContainerInterface;
7
use Interop\Container\Exception\ContainerException;
8
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
9
use Zend\ServiceManager\Exception\ServiceNotFoundException;
10
use Zend\ServiceManager\Factory\FactoryInterface;
11
12
class DeleteShortUrlsOptionsFactory implements FactoryInterface
13
{
14
    /**
15
     * Create an object
16
     *
17
     * @param  ContainerInterface $container
18
     * @param  string $requestedName
19
     * @param  null|array $options
20
     * @return object
21
     * @throws ServiceNotFoundException if unable to resolve the service.
22
     * @throws ServiceNotCreatedException if an exception is raised when
23
     *     creating a service.
24
     * @throws ContainerException if any other error occurs
25
     */
26
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
27
    {
28
        $config = $container->has('config') ? $container->get('config') : [];
29
        return new DeleteShortUrlsOptions($config['delete_short_urls'] ?? []);
30
    }
31
}
32