Module::getViewHelperConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of the Adlogix package.
4
 *
5
 * (c) Allan Segebarth <[email protected]>
6
 * (c) Jean-Jacques Courtens <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Adlogix\Zf2Rollout;
13
14
15
use Opensoft\Rollout\Rollout;
16
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
17
use Zend\ModuleManager\Feature\ConfigProviderInterface;
18
use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
19
use Zend\ServiceManager\AbstractPluginManager;
20
21
final class Module implements ConfigProviderInterface, ViewHelperProviderInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function getConfig()
27
    {
28
        return include __DIR__ . '/../config/module.config.php';
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getViewHelperConfig()
35
    {
36
        return [
37
            'factories' => [
38
                'rollout_is_active' => function (AbstractPluginManager $pluginManager) {
39
                    $serviceLocator = $pluginManager->getServiceLocator();
40
                    /** @var Rollout $rollout */
41
                    $rollout = $serviceLocator->get('zf2_rollout');
42
                    return new View\Helper\IsActive($rollout);
43
                },
44
                'rollout_description' => function (AbstractPluginManager $pluginManager) {
45
                    $serviceLocator = $pluginManager->getServiceLocator();
46
                    $rolloutConfig = $serviceLocator->get('zf2_rollout_config');
47
                    return new View\Helper\Description($rolloutConfig['features']);
48
                }
49
            ],
50
        ];
51
    }
52
}