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
Push — master ( 75bdf9...8faa57 )
by joseph
83:56 queued 81:04
created

RemoveUnusedRelationsCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Test Coverage

Coverage 68.75%

Importance

Changes 0
Metric Value
wmc 5
eloc 31
dl 0
loc 63
ccs 22
cts 32
cp 0.6875
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 17 2
A execute() 0 19 2
A __construct() 0 4 1
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 1
    public function __construct(UnusedRelationsRemover $remover, ?string $name = null)
18
    {
19 1
        parent::__construct($name);
20 1
        $this->remover = $remover;
21 1
    }
22
23
    /**
24
     * @throws DoctrineStaticMetaException
25
     */
26 1
    public function configure(): void
27
    {
28
        try {
29 1
            $this->setName(AbstractCommand::COMMAND_PREFIX . 'remove:unusedRelations')
30 1
                 ->setDefinition(
31
                     [
32 1
                         $this->getProjectRootPathOption(),
33 1
                         $this->getProjectRootNamespaceOption(),
34
                     ]
35 1
                 )->setDescription(
36 1
                     'Find and remove unused relations traits and interfaces'
37
                 );
38
        } catch (\Exception $e) {
39
            throw new DoctrineStaticMetaException(
40
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
41
                $e->getCode(),
42
                $e
43
            );
44
        }
45 1
    }
46
47
    /**
48
     * @param InputInterface  $input
49
     * @param OutputInterface $output
50
     *
51
     * @return int|null|void
52
     * @throws DoctrineStaticMetaException
53
     */
54 1
    public function execute(InputInterface $input, OutputInterface $output)
55
    {
56
        try {
57 1
            $output->writeln(
58 1
                '<comment>Finding and Removing Unused Generated Code</comment>'
59
            );
60 1
            $this->checkOptions($input);
61 1
            $removedFiles = $this->remover->run(
62 1
                $input->getOption(self::OPT_PROJECT_ROOT_PATH),
63 1
                $input->getOption(self::OPT_PROJECT_ROOT_NAMESPACE)
64
            );
65 1
            $output->writeln('<comment>Removed ' . count($removedFiles) . ' Files:</comment>');
66 1
            $output->writeln(print_r($removedFiles, true));
67 1
            $output->writeln('<info>completed</info>');
68
        } catch (\Exception $e) {
69
            throw new DoctrineStaticMetaException(
70
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
71
                $e->getCode(),
72
                $e
73
            );
74
        }
75 1
    }
76
}
77