ConfigLoaderHelperFactory::__invoke()   A
last analyzed

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 1
Bugs 0 Features 1
Metric Value
c 1
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\Console\Helper;
9
10
use GravityMedia\Commander\Config\Loader;
11
use Interop\Container\ContainerInterface;
12
use Interop\Container\Exception\ContainerException;
13
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
14
use Zend\ServiceManager\Exception\ServiceNotFoundException;
15
use Zend\ServiceManager\Factory\FactoryInterface;
16
17
/**
18
 * Config loader helper factory class.
19
 *
20
 * @package GravityMedia\Commander\Serializer
21
 */
22
class ConfigLoaderHelperFactory implements FactoryInterface
23
{
24
    /**
25
     * Create config loader helper object.
26
     *
27
     * @param  ContainerInterface $container
28
     * @param  string             $requestedName
29
     * @param  null|array         $options
30
     *
31
     * @return ConfigLoaderHelper
32
     *
33
     * @throws ServiceNotFoundException if unable to resolve the service.
34
     * @throws ServiceNotCreatedException if an exception is raised when creating a service.
35
     * @throws ContainerException if any other error occurs.
36
     */
37 2
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
38
    {
39
        /** @var Loader $commanderConfigLoader */
40 2
        $commanderConfigLoader = $container->get(Loader::class);
41
42 2
        return new ConfigLoaderHelper($commanderConfigLoader);
43
    }
44
}
45