Completed
Push — master ( 7cf2a7...686a12 )
by Matthias
09:06
created

LegacyControllerOptionsFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace MaglLegacyApplication\Factory;
5
6
7
use Interop\Container\ContainerInterface;
8
use Interop\Container\Exception\ContainerException;
9
use MaglLegacyApplication\Options\LegacyControllerOptions;
10
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
11
use Zend\ServiceManager\Exception\ServiceNotFoundException;
12
use Zend\ServiceManager\FactoryInterface;
13
use Zend\ServiceManager\ServiceLocatorInterface;
14
15
class LegacyControllerOptionsFactory implements FactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Zend\ServiceManager\FactoryInterface has been deprecated with message: Use Zend\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
16
{
17
18
    /**
19
     * Create service
20
     *
21
     * @param ServiceLocatorInterface $serviceLocator
22
     * @return mixed
23
     */
24
    public function createService(ServiceLocatorInterface $serviceLocator)
25
    {
26
        return $this->__invoke($serviceLocator, 'MaglLegacyApplicationOptions');
27
    }
28
29
    /**
30
     * Create an object
31
     *
32
     * @param ContainerInterface $container
33
     * @param string $requestedName
34
     * @param null|array $options
35
     * @return object
36
     * @throws ServiceNotFoundException if unable to resolve the service.
37
     * @throws ServiceNotCreatedException if an exception is raised when
38
     *     creating a service.
39
     * @throws ContainerException if any other error occurs
40
     */
41
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
42
    {
43
        $config = $container->get('Config');
44
        $options = $config['magl_legacy_application'];
45
46
        return new LegacyControllerOptions($options);
47
    }
48
}
49