ModuleOptionsFactory::createService()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 1
nop 1
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