ModuleOptionsFactory.php 864 Bytes
Newer Older
1
2
3
4
<?php

namespace UnicaenAuth\Options;

5
use Interop\Container\ContainerInterface;
6
7
8
9
10
11
12
13
14
15
16
17
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
 * Description of ModuleOptionsFactory
 *
 * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
 */
class ModuleOptionsFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
18
19
20
21
22
23
        return $this->__invoke($serviceLocator, '?');
    }

    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $config       = $container->get('Configuration');
24
        $moduleConfig = isset($config['unicaen-auth']) ? $config['unicaen-auth'] : [];
25
        $moduleConfig = array_merge($config['zfcuser'], $moduleConfig);
26

27
28
29
        return new ModuleOptions($moduleConfig);
    }
}