MigrationsStatusCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 20
ccs 0
cts 10
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 1
A configure() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the AntiMattr MongoDB Migrations Bundle, a library by Matthew Fitzgerald.
5
 *
6
 * (c) 2014 Matthew Fitzgerald
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace AntiMattr\Bundle\MongoDBMigrationsBundle\Command;
13
14
use AntiMattr\MongoDB\Migrations\Tools\Console\Command\StatusCommand;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Input\InputOption;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
/**
20
 * @author Matthew Fitzgerald <[email protected]>
21
 */
22
class MigrationsStatusCommand extends StatusCommand
23
{
24
    protected function configure()
25
    {
26
        parent::configure();
27
28
        $this
29
            ->setName('mongodb:migrations:status')
30
            ->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', 'default_document_manager')
31
        ;
32
    }
33
34
    public function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        CommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm'));
0 ignored issues
show
Bug introduced by
It seems like $input->getOption('dm') can also be of type string[]; however, parameter $dmName of AntiMattr\Bundle\MongoDB...cationDocumentManager() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
        CommandHelper::setApplicationDocumentManager($this->getApplication(), /** @scrutinizer ignore-type */ $input->getOption('dm'));
Loading history...
Bug introduced by
It seems like $this->getApplication() can also be of type null; however, parameter $application of AntiMattr\Bundle\MongoDB...cationDocumentManager() does only seem to accept Symfony\Bundle\FrameworkBundle\Console\Application, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
        CommandHelper::setApplicationDocumentManager(/** @scrutinizer ignore-type */ $this->getApplication(), $input->getOption('dm'));
Loading history...
37
38
        $configuration = $this->getMigrationConfiguration($input, $output);
39
        CommandHelper::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
0 ignored issues
show
Bug introduced by
The method getKernel() does not exist on Symfony\Component\Console\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        CommandHelper::configureMigrations($this->getApplication()->/** @scrutinizer ignore-call */ getKernel()->getContainer(), $configuration);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
41
        parent::execute($input, $output);
42
    }
43
}
44