ProcessCollectionFile::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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