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

DiffCommand::removeMatchingColumns()   C

Complexity

Conditions 12
Paths 7

Size

Total Lines 32
Code Lines 14

Duplication

Lines 14
Ratio 43.75 %

Code Coverage

Tests 0
CRAP Score 156

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 14
loc 32
ccs 0
cts 23
cp 0
rs 5.1612
cc 12
eloc 14
nc 7
nop 1
crap 156

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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