Completed
Pull Request — master (#57)
by Dima
02:53
created

DiffCommand::listOfTables()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
//----------------------------------------------------------------------------------------------------------------------
3
namespace SetBased\Audit\MySql\Command;
4
5
use SetBased\Audit\MySql\AuditDataLayer;
6
use SetBased\Audit\MySql\AuditDiff;
7
use SetBased\Stratum\Style\StratumStyle;
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
/**
15
 * Command for comparing data tables with audit tables.
16
 */
17
class DiffCommand extends AuditCommand
18
{
19
  //--------------------------------------------------------------------------------------------------------------------
20
  /**
21
   * Check full full and return array without new or obsolete columns if full not set.
22
   *
23
   * @param array[] $columns The metadata of the columns of a table.
24
   *
25
   * @var StratumStyle
26
   */
27
  protected $io;
28
29
  //--------------------------------------------------------------------------------------------------------------------
30
  /**
31
   * {@inheritdoc}
32
   */
33 5
  protected function configure()
34
  {
35 5
    $this->setName('diff')
36 5
         ->setDescription('Compares data tables and audit tables')
37 5
         ->addArgument('config file', InputArgument::OPTIONAL, 'The audit configuration file', 'etc/audit.json')
38 5
         ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns');
39 5
  }
40
41
  //--------------------------------------------------------------------------------------------------------------------
42
  /**
43
   * {@inheritdoc}
44
   */
45 4
  protected function execute(InputInterface $input, OutputInterface $output)
46
  {
47 4
    $this->io = new StratumStyle($input, $output);
48
49 4
    $this->configFileName = $input->getArgument('config file');
50 4
    $this->readConfigFile();
51
52 4
    $this->connect($this->config);
53
54 4
    $diff = new AuditDiff($this->config, $this->configMetadata, $this->io, $input, $output);
55 4
    $diff->main();
56 4
  }
57
58
  //--------------------------------------------------------------------------------------------------------------------
59
60
}
61
62
//----------------------------------------------------------------------------------------------------------------------
63