GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

OverrideCreateCommand::configure()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2.5679

Importance

Changes 0
Metric Value
cc 2
eloc 17
nc 2
nop 0
dl 0
loc 23
ccs 11
cts 23
cp 0.4783
crap 2.5679
rs 9.7
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command;
6
7
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\PostProcessor\FileOverrider;
8
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
9
use Exception;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Input\InputOption;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
class OverrideCreateCommand extends AbstractCommand
15
{
16
    public const OPT_OVERRIDE_FILE       = 'file';
17
    public const OPT_OVERRIDE_FILE_SHORT = 'f';
18
19
    /**
20
     * @var FileOverrider
21
     */
22
    protected $fileOverrider;
23
24 1
    public function __construct(FileOverrider $fileOverrider, ?string $name = null)
25
    {
26 1
        parent::__construct($name);
27 1
        $this->fileOverrider = $fileOverrider;
28 1
    }
29
30 1
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32 1
        $this->checkOptions($input);
33 1
        $output->writeln('<comment>Creating override for ' .
34 1
                         basename($input->getOption(self::OPT_OVERRIDE_FILE)) .
0 ignored issues
show
Bug introduced by
It seems like $input->getOption(self::OPT_OVERRIDE_FILE) can also be of type string[]; however, parameter $path of basename() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

34
                         basename(/** @scrutinizer ignore-type */ $input->getOption(self::OPT_OVERRIDE_FILE)) .
Loading history...
35 1
                         '</comment>');
36 1
        $this->checkOptions($input);
37 1
        $this->fileOverrider->setPathToProjectRoot($input->getOption(self::OPT_PROJECT_ROOT_PATH));
38 1
        $pathCreated = $this->fileOverrider->createNewOverride($input->getOption(self::OPT_OVERRIDE_FILE));
39 1
        $output->writeln('<info>Override created at: ' . $pathCreated . '</info>');
40 1
    }
41
42
    /**
43
     * @throws DoctrineStaticMetaException
44
     */
45 1
    protected function configure(): void
46
    {
47
        try {
48
            $this
49 1
                ->setName(AbstractCommand::COMMAND_PREFIX . 'overrides:create')
50 1
                ->setDefinition(
51
                    [
52 1
                        new InputOption(
53 1
                            self::OPT_OVERRIDE_FILE,
54 1
                            self::OPT_OVERRIDE_FILE_SHORT,
55 1
                            InputOption::VALUE_REQUIRED,
56 1
                            'the absolute path of the project file you want to override'
57
                        ),
58 1
                        $this->getProjectRootPathOption(),
59
                    ]
60 1
                )->setDescription(
61 1
                    'Create new overrides for project files'
62
                );
63
        } catch (Exception $e) {
64
            throw new DoctrineStaticMetaException(
65
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
66
                $e->getCode(),
67
                $e
68
            );
69
        }
70 1
    }
71
}
72