Passed
Push — 10.x ( f9701d )
by Tim
04:36
created

ImportCreateOkFileCommand::executeSimpleCommand()   B

Complexity

Conditions 6
Paths 12

Size

Total Lines 58
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 6
eloc 21
c 2
b 0
f 0
nc 12
nop 3
dl 0
loc 58
ccs 0
cts 32
cp 0
crap 42
rs 8.9617

How to fix   Long Method   

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
/**
4
 * TechDivision\Import\Cli\Command\ImportCreateOkFileCommand
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-cli-simple
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Cli\Command;
22
23
use Symfony\Component\Console\Input\InputArgument;
24
use TechDivision\Import\Utils\CommandNames;
25
26
/**
27
 * The command implementation that creates a OK file from a directory with CSV files.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @copyright 2016 TechDivision GmbH <[email protected]>
31
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
32
 * @link      https://github.com/techdivision/import-cli-simple
33
 * @link      http://www.techdivision.com
34
 */
35
class ImportCreateOkFileCommand extends AbstractImportCommand
36
{
37
38
    /**
39
     * Configures the current command.
40
     *
41
     * @return void
42
     * @see \Symfony\Component\Console\Command\Command::configure()
43
     */
44
    protected function configure()
45
    {
46
47
        // initialize the command with the required/optional options
48
        $this->setName(CommandNames::IMPORT_CREATE_OK_FILE)
49
            ->addArgument(InputArgumentKeys::SHORTCUT, InputArgument::OPTIONAL, 'The shortcut that defines the operation(s) that has to be used for the import, one of "create-ok-files" or a combination of them', 'create-ok-files')
50
            ->setDescription('Create\'s the OK file for the CSV files of the configured source directory');
51
52
        // invoke the parent method
53
        parent::configure();
54
    }
55
}
56