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 (#199)
by joseph
21:04
created

FinaliseBuildCommand::configure()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 13
nc 2
nop 0
dl 0
loc 18
ccs 0
cts 18
cp 0
crap 6
rs 9.8333
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\Action\CreateDtosForAllEntitiesAction;
6
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\PostProcessor\EntityFormatter;
7
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class FinaliseBuildCommand extends AbstractCommand
12
{
13
    /**
14
     * @var CreateDtosForAllEntitiesAction
15
     */
16
    private $action;
17
    /**
18
     * @var EntityFormatter
19
     */
20
    private $entityFormatter;
21
22
    public function __construct(
23
        CreateDtosForAllEntitiesAction $action,
24
        EntityFormatter $entityFormatter,
25
        ?string $name = null
26
    ) {
27
        parent::__construct($name);
28
        $this->action          = $action;
29
        $this->entityFormatter = $entityFormatter;
30
    }
31
32
    public function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        try {
35
            $this->checkOptions($input);
36
            $output->writeln(
37
                '<comment>Starting generation of data transfer objects for all entities</comment>'
38
            );
39
            $this->action->setProjectRootNamespace($input->getOption(self::OPT_PROJECT_ROOT_NAMESPACE))
40
                         ->setProjectRootDirectory($input->getOption(self::OPT_PROJECT_ROOT_PATH))
41
                         ->run();
42
            $output->writeln(
43
                '<comment>Formatting Entities</comment>'
44
            );
45
            $this->entityFormatter->setPathToProjectRoot($input->getOption(self::OPT_PROJECT_ROOT_PATH))
46
                                  ->run();
47
            $output->writeln('<info>completed</info>');
48
        } catch (\Exception $e) {
49
            throw new DoctrineStaticMetaException(
50
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
51
                $e->getCode(),
52
                $e
53
            );
54
        }
55
    }
56
57
    /**
58
     * @throws DoctrineStaticMetaException
59
     */
60
    protected function configure(): void
61
    {
62
        try {
63
            $this
64
                ->setName(AbstractCommand::COMMAND_PREFIX . 'finalise:build')
65
                ->setDefinition(
66
                    [
67
                        $this->getProjectRootPathOption(),
68
                        $this->getProjectRootNamespaceOption(),
69
                    ]
70
                )->setDescription(
71
                    'Generate or update all Data Transfer Objects for all Entities and perform other post processes'
72
                );
73
        } catch (\Exception $e) {
74
            throw new DoctrineStaticMetaException(
75
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
76
                $e->getCode(),
77
                $e
78
            );
79
        }
80
    }
81
}
82