Completed
Push — develop ( 67e161...8b0772 )
by Paul
05:50
created

ConsoleContainerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A invoke() 0 8 1
1
<?php
2
3
namespace PhpUnitGen\Container;
4
5
use League\Flysystem\Adapter\Local;
6
use League\Flysystem\Filesystem;
7
use League\Flysystem\FilesystemInterface;
8
use PhpUnitGen\Configuration\ConsoleConfigInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * Class ConsoleContainerFactory.
13
 *
14
 * @author     Paul Thébaud <[email protected]>.
15
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
16
 * @license    https://opensource.org/licenses/MIT The MIT license.
17
 * @link       https://github.com/paul-thebaud/phpunit-generator
18
 * @since      Class available since Release 2.0.0.
19
 */
20
class ConsoleContainerFactory implements ConsoleContainerFactoryInterface
21
{
22
    private $containerFactory;
23
24
    public function __construct()
25
    {
26
        $this->containerFactory = new ContainerFactory();
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function invoke(ConsoleConfigInterface $config, OutputInterface $output): ContainerInterface
33
    {
34
        $container = $this->containerFactory->invoke($config);
35
36
        $container->setInstance(FilesystemInterface::class, new Filesystem(new Local('./')));
37
        $container->setInstance(OutputInterface::class, $output);
38
39
        return $container;
40
    }
41
}
42