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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 6
dl 0
loc 35
rs 10
c 4
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 23 2
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