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 ( cc354f...2af0ad )
by joseph
12s
created

RemoveUnusedRelationsCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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