Passed
Pull Request — master (#23)
by Dmitrij
02:57
created

ProcessRequireJs::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 2
1
<?php
2
3
namespace HotRodCli\Processors;
4
5
use HotRodCli\AppContainer;
6
use HotRodCli\Jobs\Filesystem\CopyFile;
7
use Symfony\Component\Console\Application;
8
use Symfony\Component\Console\Input\ArrayInput;
9
use Symfony\Component\Filesystem\Filesystem;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
class ProcessRequireJs
14
{
15
    protected $appContainer;
16
17
    public function __construct(AppContainer $appContainer)
18
    {
19
        $this->appContainer = $appContainer;
20
    }
21
22
    public function __invoke(InputInterface $input, OutputInterface $output)
23
    {
24
        $app = $this->appContainer;
25
26
        /** @var Application $application */
27
        $application = $app->resolve(Application::class);
28
        $command = $application->find('create:requirejs-config');
29
30
        $inputs = [
31
            'namespace' => $input->getArgument('namespace')
32
        ];
33
34
        if ($input->getOption('admin')) {
35
            $inputs['--admin'] = 'true';
36
        }
37
38
        $greetInput = new ArrayInput($inputs);
39
        $command->run($greetInput, $output);
40
    }
41
}
42