Completed
Push — develop ( 8b0772...a0b2b6 )
by Paul
04:54
created

GenerateOneDefaultCommand::getConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PhpUnitGen\Console;
4
5
use PhpUnitGen\Configuration\ConfigurationInterface\ConsoleConfigFactoryInterface;
6
use PhpUnitGen\Configuration\ConfigurationInterface\ConsoleConfigInterface;
7
use PhpUnitGen\Configuration\DefaultConsoleConfigFactory;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
11
/**
12
 * Class GenerateOneDefaultCommand.
13
 *
14
 * @author     Paul Thébaud <[email protected]>.
15
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
16
 * @license    https://opensource.org/licenses/MIT The MIT license.
17
 * @link       https://github.com/paul-thebaud/phpunit-generator
18
 * @since      Class available since Release 2.0.0.
19
 */
20
class GenerateOneDefaultCommand extends AbstractGenerateCommand
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    protected function configure()
26
    {
27
        $this->setName("generate-one-default")
28
            ->setDescription("Generate unit tests skeletons with a default configuration for only one file")
29
            ->setHelp("Use it to generate your unit tests skeletons from a default config")
30
            ->addArgument('source-file-path', InputArgument::REQUIRED, 'The source file path.')
31
            ->addArgument('target-file-path', InputArgument::REQUIRED, 'The target file path.');
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getConfiguration(InputInterface $input): ConsoleConfigInterface
38
    {
39
        $sourceFile = $input->getArgument('source-file-path');
40
        $targetFile = $input->getArgument('target-file-path');
41
42
        $factory = new DefaultConsoleConfigFactory();
43
        return $factory->invokeOneFile($sourceFile, $targetFile);
44
    }
45
}
46