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.
Completed
Pull Request — master (#178)
by joseph
127:53 queued 124:55
created

OverrideCreateCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 2
dl 0
loc 10
ccs 9
cts 9
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\PostProcessor\FileOverrider;
6
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class OverrideCreateCommand extends AbstractCommand
12
{
13
    public const OPT_OVERRIDE_FILE       = 'file';
14
    public const OPT_OVERRIDE_FILE_SHORT = 'f';
15
16
    /**
17
     * @var FileOverrider
18
     */
19
    protected $fileOverrider;
20
21 1
    public function __construct(FileOverrider $fileOverrider, ?string $name = null)
22
    {
23 1
        parent::__construct($name);
24 1
        $this->fileOverrider = $fileOverrider;
25 1
    }
26
27 1
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29 1
        $this->checkOptions($input);
30 1
        $output->writeln('<comment>Creating override for ' .
31 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

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