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.

CreateCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Dami\Cli\Command;
4
5
use Symfony\Component\Console\Input\InputArgument,
6
    Symfony\Component\Console\Input\InputOption,
7
    Symfony\Component\Console\Command\Command,
8
    Symfony\Component\Console\Input\InputInterface,
9
    Symfony\Component\Console\Output\OutputInterface,
10
    Symfony\Component\Filesystem\Filesystem;
11
12
use Dami\Migration\TemplateRenderer,
13
    Dami\Migration\FileNameBuilder;
14
15
class CreateCommand extends ContainerAwareCommand
16
{
17
    protected function configure()
18
    {
19
        parent::configure();
20
21
        $this
22
            ->setDescription('Create a new migration.')
23
            ->addArgument('migration_name', InputArgument::REQUIRED, 'Migration name');
24
    }
25
26
    protected function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        parent::execute($input, $output);
29
30
        $arguments = $input->getArguments();
31
        $migrationName = $arguments['migration_name'];
32
33
        $filenameBuilder = new FileNameBuilder($migrationName);
34
        $fileSystem = new Filesystem();
35
        $templateRenderer = $this->getContainer()->get('dami.template_renderer');
36
        $migrationDirectory = $this->getContainer()->getparameter('dami.migrations_directory');
37
38
        try {
39
            $fileName = $filenameBuilder->build();
40
            $path = $migrationDirectory . '/' . $fileName;
41
            $fileSystem->dumpFile($path, $templateRenderer->render($migrationName));
42
43
            $output->writeln('<info>Migration has been created.</info>');
44
            $output->writeln(sprintf('<comment>Location: %s</comment>', $path));
45
        } catch (\Exception $e) {
46
            $output->writeln(sprintf("<error>Something went wrong.</error>\n\n%s", $e->getMessage()));
47
        }
48
    }
49
}
50