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 (#137)
by joseph
60:53 queued 35:20
created

OverrideCreateCommand::configure()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2.122

Importance

Changes 0
Metric Value
cc 2
eloc 17
nc 2
nop 0
dl 0
loc 23
ccs 11
cts 16
cp 0.6875
crap 2.122
rs 9.7
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\NamespaceHelper;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\PostProcessor\FileOverrider;
7
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class OverrideCreateCommand extends AbstractCommand
13
{
14
    public const OPT_OVERRIDE_FILE       = 'file';
15
    public const OPT_OVERRIDE_FILE_SHORT = 'f';
16
17
    /**
18
     * @var FileOverrider
19
     */
20
    protected $fileOverrider;
21
22 1
    public function __construct(FileOverrider $fileOverrider, NamespaceHelper $namespaceHelper, ?string $name = null)
23
    {
24 1
        parent::__construct($namespaceHelper, $name);
25 1
        $this->fileOverrider = $fileOverrider;
26 1
    }
27
28 1
    protected function execute(InputInterface $input, OutputInterface $output)
29
    {
30 1
        $this->fileOverrider->setPathToProjectRoot($input->getOption(self::OPT_PROJECT_ROOT_PATH));
31 1
        $pathCreated = $this->fileOverrider->createNewOverride($input->getOption(self::OPT_OVERRIDE_FILE));
32 1
        $output->writeln('<info>Override created at: ' . $pathCreated . '</info>');
33 1
    }
34
35
    /**
36
     * @throws DoctrineStaticMetaException
37
     */
38 1
    protected function configure(): void
39
    {
40
        try {
41
            $this
42 1
                ->setName(AbstractCommand::COMMAND_PREFIX . 'overrides:create')
43 1
                ->setDefinition(
44
                    [
45 1
                        new InputOption(
46 1
                            self::OPT_OVERRIDE_FILE,
47 1
                            self::OPT_OVERRIDE_FILE_SHORT,
48 1
                            InputOption::VALUE_REQUIRED,
49 1
                            'the absolute path of the project file you want to override'
50
                        ),
51 1
                        $this->getProjectRootPathOption(),
52
                    ]
53 1
                )->setDescription(
54 1
                    'Create new overrides for project files'
55
                );
56
        } catch (\Exception $e) {
57
            throw new DoctrineStaticMetaException(
58
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
59
                $e->getCode(),
60
                $e
61
            );
62
        }
63 1
    }
64
}
65