ModuleOptionsFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 10 2
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoCanonicalRedirect for the canonical source repository
6
 * @copyright   Copyright (c) 2014-2017 Webino, s. r. o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoCanonicalRedirect\Factory;
12
13
use WebinoCanonicalRedirect\Options\ModuleOptions;
14
use Zend\ServiceManager\FactoryInterface;
15
use Zend\ServiceManager\ServiceLocatorInterface;
16
17
/**
18
 * Factory for the module options
19
 */
20
class ModuleOptionsFactory implements FactoryInterface
21
{
22
    /**
23
     * @param ServiceLocatorInterface $services
24
     * @return ModuleOptions
25
     */
26
    public function createService(ServiceLocatorInterface $services)
27
    {
28
        $config = $services->get('Config');
29
30
        return new ModuleOptions(
31
            !empty($config['webino_canonical_redirect'])
32
            ? $config['webino_canonical_redirect']
33
            : array()
34
        );
35
    }
36
}
37