Completed
Push — master ( baff27...3a9c47 )
by Daniel
02:56
created

LoaderFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
crap 1
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 2
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
37
    {
38
        /** @var Serializer $serializer */
39 2
        $serializer = $container->get(Serializer::class);
40
41 2
        return new Loader($serializer);
42
    }
43
}
44