Completed
Pull Request — master (#40)
by Dima
06:19
created

DiffCommand::getDiff()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 19
ccs 0
cts 16
cp 0
rs 9.2
cc 4
eloc 10
nc 4
nop 0
crap 20
1
<?php
2
//----------------------------------------------------------------------------------------------------------------------
3
namespace SetBased\Audit\MySql\Command;
4
5
use SetBased\Audit\MySql\AuditDiff;
6
use SetBased\Stratum\Style\StratumStyle;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
//----------------------------------------------------------------------------------------------------------------------
13
/**
14
 * Command for comparing data tables with audit tables.
15
 */
16
class DiffCommand extends AuditCommand
17
{
18
  //--------------------------------------------------------------------------------------------------------------------
19
  /**
20
   * The Output decorator.
21
   *
22
   * @var StratumStyle
23
   */
24
  protected $io;
25
26
  //--------------------------------------------------------------------------------------------------------------------
27
  /**
28
   * {@inheritdoc}
29
   */
30 1
  protected function configure()
31
  {
32 1
    $this->setName('diff')
33 1
         ->setDescription('Compares data tables and audit tables')
34 1
         ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json')
35 1
         ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns');
36 1
  }
37
38
  //--------------------------------------------------------------------------------------------------------------------
39
  /**
40
   * {@inheritdoc}
41
   */
42 View Code Duplication
  protected function execute(InputInterface $input, OutputInterface $output)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
  {
44
    $this->io = new StratumStyle($input, $output);
45
46
    $this->configFileName = $input->getArgument('config file');
47
    $this->readConfigFile();
48
49
    $this->connect($this->config);
50
51
    $diff = new AuditDiff($this->config, $this->io, $input, $output);
52
    $diff->main();
53
  }
54
55
  //--------------------------------------------------------------------------------------------------------------------
56
}
57
58
//----------------------------------------------------------------------------------------------------------------------
59