DiffCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace SetBased\Audit\Command;
5
6
use SetBased\Audit\Audit\Diff;
7
use SetBased\Audit\Style\AuditStyle;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Input\InputOption;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * Command for comparing data tables with audit tables.
15
 */
16
class DiffCommand extends AuditCommand
17
{
18
  //--------------------------------------------------------------------------------------------------------------------
19
  /**
20
   * @inheritdoc
21
   */
22 6
  protected function configure()
23
  {
24 6
    $this->setName('diff')
25 6
         ->setDescription('Compares data tables and audit tables')
26 6
         ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file')
27 6
         ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns');
28 6
  }
29
30
  //--------------------------------------------------------------------------------------------------------------------
31
  /**
32
   * @inheritdoc
33
   */
34 6
  protected function execute(InputInterface $input, OutputInterface $output): int
35
  {
36 6
    $this->io = new AuditStyle($input, $output);
37
38 6
    $this->configFileName = $input->getArgument('config file');
39 6
    $this->readConfigFile();
40
41 6
    $this->connect();
42
43 6
    $diff = new Diff($this->config, $this->io, $input, $output);
44 6
    $diff->main();
45
46 6
    return 0;
47
  }
48
49
  //--------------------------------------------------------------------------------------------------------------------
50
}
51
52
//----------------------------------------------------------------------------------------------------------------------
53