RunProcessCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 29
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 12 1
A configure() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\Processor\Communication\Console;
5
6
7
use DataProvider\ProcessRunDataProvider;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
use Xervice\Console\Business\Model\Command\AbstractCommand;
12
13
/**
14
 * @method \Xervice\Processor\Business\ProcessorFacade getFacade()
15
 */
16
class RunProcessCommand extends AbstractCommand
17
{
18
    protected function configure()
19
    {
20
        $this
21
            ->setName('process:run')
22
            ->addOption('process', 'p', InputOption::VALUE_REQUIRED, 'Process name')
23
            ->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'Output file')
24
            ->addOption('input', 'i', InputOption::VALUE_REQUIRED, 'Input file');
25
    }
26
27
    /**
28
     * @param \Symfony\Component\Console\Input\InputInterface $input
29
     * @param \Symfony\Component\Console\Output\OutputInterface $output
30
     *
31
     * @return int|void|null
32
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        $processName = $input->getOption('process');
36
        $inputFile = $input->getOption('input');
37
        $outputFile = $input->getOption('output');
38
39
        $process = (new ProcessRunDataProvider())
40
            ->setName($processName)
41
            ->setInput($inputFile)
42
            ->setOutput($outputFile);
43
44
        $this->getFacade()->runProcess($process);
45
    }
46
}