LoaderFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 1
c 2
b 0
f 1
lcom 0
cbo 2
dl 0
loc 23
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 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