Passed
Pull Request — master (#69)
by Dave
02:21
created

BaseLineFileHelper::getBaselineFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DaveLiddament\StaticAnalysisResultsBaseliner\Framework\Command\internal;
6
7
use DaveLiddament\StaticAnalysisResultsBaseliner\Domain\Common\BaseLineFileName;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Input\InputOption;
12
13
class BaseLineFileHelper
14
{
15
    private const BASELINE_FILE = 'baseline-file';
16
17
    public static function configureBaseLineFileArgument(Command $command): void
18
    {
19
        $command->addArgument(
20
            self::BASELINE_FILE,
21
            InputArgument::REQUIRED, 'Baseline file'
22
        );
23
        $command->addOption(
24
            self::BASELINE_FILE,
25
            null,
26
            InputOption::VALUE_REQUIRED,
27
            'Path to the root of the project you are creating baseline for'
28
        );
29
    }
30
31
    /**
32
     * @throws InvalidConfigException
33
     */
34
    public static function getBaselineFile(InputInterface $input): BaseLineFileName
35
    {
36
        return new BaseLineFileName(CliConfigReader::getArgument($input, self::BASELINE_FILE));
37
    }
38
}
39