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

SetEmbeddableCommand::execute()   A

Complexity

Conditions 2
Paths 5

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2.122

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 21
rs 9.7
c 0
b 0
f 0
ccs 11
cts 16
cp 0.6875
cc 2
nc 5
nop 2
crap 2.122
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command;
4
5
use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\Embeddable\EntityEmbeddableSetter;
6
use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class SetEmbeddableCommand extends AbstractCommand
12
{
13
    public const OPT_ENTITY       = 'entity';
14
    public const OPT_ENTITY_SHORT = 'o';
15
16
    public const OPT_EMBEDDABLE       = 'embeddable';
17
    public const OPT_EMBEDDABLE_SHORT = 'b';
18
    /**
19
     * @var EntityEmbeddableSetter
20
     */
21
    protected $embeddableSetter;
22
23 1
    public function __construct(
24
        EntityEmbeddableSetter $embeddableSetter,
25
        ?string $name = null
26
    ) {
27 1
        parent::__construct($name);
28 1
        $this->embeddableSetter = $embeddableSetter;
29 1
    }
30
31
    /**
32
     * @throws DoctrineStaticMetaException
33
     */
34 1
    public function configure(): void
35
    {
36
        try {
37 1
            $this->setName(AbstractCommand::COMMAND_PREFIX . 'set:embeddable')
38 1
                 ->setDefinition(
39
                     [
40 1
                         new InputOption(
41 1
                             self::OPT_ENTITY,
42 1
                             self::OPT_ENTITY_SHORT,
43 1
                             InputOption::VALUE_REQUIRED,
44 1
                             'Entity Fully Qualified Name'
45
                         ),
46 1
                         new InputOption(
47 1
                             self::OPT_EMBEDDABLE,
48 1
                             self::OPT_EMBEDDABLE_SHORT,
49 1
                             InputOption::VALUE_REQUIRED,
50 1
                             'Embeddable Trait Fully Qualified Name'
51
                         ),
52
                     ]
53 1
                 )->setDescription(
54 1
                     'Set an Entity as having an Embeddable by way of using the Embeddable Trait'
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
    /**
66
     * @param InputInterface  $input
67
     * @param OutputInterface $output
68
     *
69
     * @return int|null|void
70
     * @throws DoctrineStaticMetaException
71
     */
72 1
    public function execute(InputInterface $input, OutputInterface $output)
73
    {
74
        try {
75 1
            $output->writeln(
76
                '<comment>Setting Entity '
77 1
                . $input->getOption(static::OPT_ENTITY)
78 1
                . ' has Embeddable ' . $input->getOption(static::OPT_EMBEDDABLE)
79 1
                . '</comment>'
80
            );
81 1
            $this->checkOptions($input);
82 1
            $this->embeddableSetter
83 1
                ->setEntityHasEmbeddable(
84 1
                    $input->getOption(static::OPT_ENTITY),
85 1
                    $input->getOption(static::OPT_EMBEDDABLE)
86
                );
87 1
            $output->writeln('<info>completed</info>');
88
        } catch (\Exception $e) {
89
            throw new DoctrineStaticMetaException(
90
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
91
                $e->getCode(),
92
                $e
93
            );
94
        }
95 1
    }
96
}
97