Completed
Push — master ( 7a08de...9ce2ea )
by Daniel
04:39
created

LoaderFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
crap 2
1
<?php
2
/**
3
 * This file is part of the Commander project.
4
 *
5
 * @author Daniel Schröder <[email protected]>
6
 */
7
8
namespace GravityMedia\Commander\Config;
9
10
use Interop\Container\ContainerInterface;
11
use Interop\Container\Exception\ContainerException;
12
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
13
use Zend\ServiceManager\Exception\ServiceNotFoundException;
14
use Zend\ServiceManager\Factory\FactoryInterface;
15
16
/**
17
 * Config loader factory class.
18
 *
19
 * @package GravityMedia\Commander\Config
20
 */
21
class LoaderFactory implements FactoryInterface
22
{
23
    /**
24
     * Create config loader object.
25
     *
26
     * @param  ContainerInterface $container
27
     * @param  string             $requestedName
28
     * @param  null|array         $options
29
     *
30
     * @return Loader
31
     *
32
     * @throws ServiceNotFoundException if unable to resolve the service.
33
     * @throws ServiceNotCreatedException if an exception is raised when creating a service.
34
     * @throws ContainerException if any other error occurs.
35
     */
36
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
37
    {
38
        /** @var Serializer $configSerializer */
39
        $configSerializer = $container->get(Serializer::class);
40
41
        return new Loader($configSerializer);
42
    }
43
}
44