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

ProcessRequireJs   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 18 2
A __construct() 0 3 1
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