HelperSetFactory::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
rs 9.4285
1
<?php
2
3
/**
4
 * Aist Console (http://mateuszsitek.com/projects/console)
5
 *
6
 * @copyright Copyright (c) 2017 DIGITAL WOLVES LTD (http://digitalwolves.ltd) All rights reserved.
7
 * @license   http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
8
 */
9
10
namespace Aist\Console\Helper;
11
12
use Interop\Container\ContainerInterface;
13
use Symfony\Component\Console\Helper\HelperSet;
14
15
/**
16
 * Factory for HelperSet
17
 */
18
class HelperSetFactory
19
{
20
    /**
21
     * @param ContainerInterface $container
22
     *
23
     * @return HelperSet
24
     */
25
    public function __invoke(ContainerInterface $container)
26
    {
27
        $config = $container->get('config');
28
29
        $helpers = [];
30
        foreach ($config['console']['helpers'] as $name => $helper) {
31
            $helpers[$name] = $container->get($helper);
32
        }
33
34
        return new HelperSet($helpers);
35
    }
36
}
37