GetDefinitionCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 2
b 0
f 0
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configure() 0 4 1
A execute() 0 7 1
1
<?php
2
3
namespace Oliverde8\PhpEtlBundle\Command;
4
5
use Oliverde8\PhpEtlBundle\Services\ChainProcessorsManager;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Symfony\Component\Yaml\Yaml;
11
12
class GetDefinitionCommand extends Command
13
{
14
    protected ChainProcessorsManager $chainProcessorsManager;
15
16
    /**
17
     * ExecuteCommand constructor.
18
     * @param ChainProcessorsManager $chainProcessorsManager
19
     */
20
    public function __construct(ChainProcessorsManager $chainProcessorsManager)
21
    {
22
        parent::__construct();
23
        $this->chainProcessorsManager = $chainProcessorsManager;
24
    }
25
26
27
    protected function configure()
28
    {
29
        $this->setName("etl:get-definition");
30
        $this->addArgument("name", InputArgument::REQUIRED);
31
    }
32
33
    /**
34
     * @throws \Oliverde8\Component\PhpEtl\Exception\ChainOperationException
35
     */
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $chainName = $input->getArgument("name");
39
        $definition = $this->chainProcessorsManager->getRawDefinition($chainName);
40
41
        echo Yaml::dump($definition, 4);
42
        return 0;
43
    }
44
}
45