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 (#154)
by joseph
34:48
created

RemoveUnusedRelationsCommand::configure()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2.1821

Importance

Changes 0
Metric Value
cc 2
eloc 14
nc 2
nop 0
dl 0
loc 20
ccs 9
cts 14
cp 0.6429
crap 2.1821
rs 9.7998
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\UnusedRelationsRemover;
6
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class RemoveUnusedRelationsCommand extends AbstractCommand
11
{
12
    /**
13
     * @var UnusedRelationsRemover
14
     */
15
    protected $remover;
16
17 3
    public function __construct(UnusedRelationsRemover $remover, ?string $name = null)
18
    {
19 3
        parent::__construct($name);
20 3
        $this->remover = $remover;
21 3
    }
22
23
    /**
24
     * @throws DoctrineStaticMetaException
25
     */
26 3
    public function configure(): void
27
    {
28
        try {
29 3
            $this->setName(AbstractCommand::COMMAND_PREFIX . 'finalise:remove-unused-relations')
30 3
                 ->setAliases([
31 3
                                  AbstractCommand::COMMAND_PREFIX . 'remove:unusedRelations',
32
                              ])
33 3
                 ->setDefinition(
34
                     [
35 3
                         $this->getProjectRootPathOption(),
36 3
                         $this->getProjectRootNamespaceOption(),
37
                     ]
38 3
                 )->setDescription(
39 3
                     'Find and remove unused relations traits and interfaces'
40
                 );
41
        } catch (\Exception $e) {
42
            throw new DoctrineStaticMetaException(
43
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
44
                $e->getCode(),
45
                $e
46
            );
47
        }
48 3
    }
49
50
    /**
51
     * @param InputInterface  $input
52
     * @param OutputInterface $output
53
     *
54
     * @return int|null|void
55
     * @throws DoctrineStaticMetaException
56
     */
57 3
    public function execute(InputInterface $input, OutputInterface $output)
58
    {
59
        try {
60 3
            $output->writeln(
61 3
                '<comment>Finding and Removing Unused Generated Code</comment>'
62
            );
63 3
            $this->checkOptions($input);
64 3
            $removedFiles = $this->remover
65 3
                ->setPathToProjectRoot($input->getOption(self::OPT_PROJECT_ROOT_PATH))
66 3
                ->setProjectRootNamespace($input->getOption(self::OPT_PROJECT_ROOT_NAMESPACE))
67 3
                ->run();
68 3
            $output->writeln('<comment>Removed ' . count($removedFiles) . ' Files:</comment>');
69 3
            $output->writeln(print_r($removedFiles, true));
70 3
            $output->writeln('<info>completed</info>');
71
        } catch (\Exception $e) {
72
            throw new DoctrineStaticMetaException(
73
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
74
                $e->getCode(),
75
                $e
76
            );
77
        }
78 3
    }
79
}
80